[APP][Pro] Simple (Sys) LOG - Use this app for Simple (Sys) Logging

How does this work?

I created a syslog device I went into settings and entered the details:
afbeelding

In the synology server I also ceated a rule to receive los on udp 516…
afbeelding

The i triggered a log card in Homey…

In the simle log the log line is written, but in the syslog server nothing happens…


afbeelding

I also tried tcp an other port and other protocol, but nothing works.
I use this syslog server also for other application and that those logs are registered.

So actually I have no idea what I am doing wrong here…

1 Like

Create a Syslog Client Device to connect to Synology.

You have now create a Syslog Server on your Homey to handle incoming syslogmessages.
:wink:

Hello Peter,

Thank you for making it clear for me.
It now works fine.

Henk

1 Like

Anyone experiencing issues with the Simple Sys Log app on Homey Pro 2019? A couple of hours after my Homey was updated to version 10.0.10, I see “The app Simple (Sys) Log has stopped working. The developer has been notified.” in my Homey timeline. I have tried uninstalling and installing the app again, same problem.

Axel,

Simple Log v3.0.35 & v3.0.33
2x Pro 2019 v10.0.10

No issues here with both Homeys after the mentioned FW update.

Did the app actually stopped working? Yeah, that might sound like a stupid question, but,
despite that error msg, I’ve seen apps just keep on working like before.

Long time ago I’ve come to the conclusion it’s best to pull the power for 10 minutes after an FW update what caused issues.
Did that help in your case?

@Peter_Kawa The app stopped working, marked with a “Crashed” tag. A power cycle indeed did the trick, thanks for the tip. I started getting nervous when it was unavailable for the first hour or so after booting, but suddenly it was back online. Perhaps time to make the switch to 2023 :sweat_smile:

1 Like

Yup, then it definately was crashed :wink:
Good to hear it’s solved for now.

Not to take anything away from the deep dive in the recent messages about servers, I would like to stress the simple use case for many: just logging and sending notifications without using any servers.

With the addition of BLL in the Simple Log cards, its use for logging is efficient and obvious.

PS
@Arie_J_Godschalk I will submit a feature request for an AND card with a list of severities. That would be more efficient than text based Logic AND cards (“…is exactly”).

2 Likes

Hi,
What crossed my mind:
You can use several triggers instead, one for each severity type?

1 Like

True and good point. As I use 6 different severity types where some of them overlap and have the same THEN action cards, it is much easier to have it all in one flow.

1 Like

Thanks @Rrrr @Peter_Kawa and @Arie_J_Godschalk your post inspired me to re-assess my messaging setup, based on Simple Log… I am currently simplifying all my flows in terms of Messages… And it looks like this (taken into account Severity level)

Advanced Flow based on Simple Log

Severity levels and Device to send message to:

Synology Log Center

Default card used in all Flows
image

3 Likes

@Wout_van_den_Dool that looks gorgeous!

And fyi, for all:
I have migrated (again) to the HP2023 past week.
And (finally) everything seems to be working correctly.
So, soon, ill be able to really start developing and picking up tickets again. :grin:

(Although im having holidays with the kids the next 4 weeks hahah)
But at least i have a non-overloaded Homey so i am at least able to develope again.
The hp2019 was so overloaded that installing my apps to test and run it, made it crash or at least function improperly.

6 Likes

@Arie_J_Godschalk Bitbucket issue #42

1 Like

Peter is this working for you now. I have been busy with all stuff and haven’t been paying attention to this en now I have got time again and see that it still doesn’t work.

kind regards, Wilfried

Is there a way to PUT a log just form HomeyScript? I’ve looked through this post and the former one, and found nothing.

The only post that said something about it, it didn’t work in my Homey Pro 2023… (Simple LOG app - Former main topic [Deprecated] - #67 by MarkS)

I’m new at Homey and learning fast about Flows, cards and HomeyScripts.

I’m eager to get some logging from a script.
This simple Log App es very useful!!
Thanks!
Ferno.

No I didn’t get it to work, Wilfried

When you mean this, yes (always check 1st posts of app topics for howto’s):

Sorry I wasn’t specific enough… I’ve been reading all through this post and I’ve tried that, but it seems there’s something I’m coding wrongly.

Here’s a copy of my script of all the different methos I’ve tried:

function simpleLog(message, groupName)
{
//  let uri = "http://localhost/api/app/nl.nielsdeklerk.log/clearLog"
//  let uri = "http://localhost/api/app/nl.nielsdeklerk.log/"

  let uri = "http://localhost/api/app/nl.nielsdeklerk.log/addLog"
  let bodyContent = JSON.stringify({ log: message });
  if(groupName != undefined)
    bodyContent = JSON.stringify({ log: message, group: groupName });
  let response = fetch( uri, 
  { method: 'PUT',
    body: bodyContent 
    } );
//  log (response);
//  let homeyScript = await Homey.apps.getApp({ id: 'nl.nielsdeklerk.log' } );
//  await homeyScript.put('addlog' , { log:message, group: groupName} );
}

function simpleLog2(message, groupName)
{
  PUT /api/app/nl.nielsdeklerk.log/addlog/
  { "log":message, "group":groupName};
}

/*
function simpleLog3(message, groupName)
{
  PUT /api/app/nl.nielsdeklerk.log/addlog/
  Content-Type: application/json
  { "log":message, "group":groupName};
}*/

simpleLog("Testing simpleLog()");
simpleLog2("Testing simpleLog2()");

//log(await Homey.apps.getApp({ id: 'nl.nielsdeklerk.log' }));
//    response = await fetch(uri, { method: 'PATCH', 'headers': headers, body: JSON.stringify(body) })
//PUT /api/app/nl.nielsdeklerk.log/addlog/
//{log: "Test 1,2,3"};


  • simpleLog function it doesn’t throw any error, but it doesn’t create the log.

  • simpleLog2 function throws the following error:
    ———————————————————
    :x: Script Error
    :warning: ReferenceError: PUT is not defined
    at simpleLog2 (testSimpleLog.js:21:3)
    at testSimpleLog.js:34:1
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  • simpleLog3 I had to comment it because it was throwing the following error:
    ———————————————————
    :x: Script Error
    :warning: testSimpleLog.js:28
    Content-Type: application/json
    ^
    SyntaxError: Unexpected token ‘:’
    at new Script (node:vm:99:7)
    at HomeyScriptApp.runScript (/app/app.js:352:23)
    at Object.runScript (/app/api.js:30:38)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Hope this information is useful for anyone to give me a hint.
Thanks in advance!
Ferno.

Finally I could log to Simple Log form a Homey Script.

I leave here the workaround I found… maybe there is some other way (perhaps a simpler one). The only thing I coudn’t achieve, is to log the Severity or Hostname:

// Definition of the function simpleLog to be called in a simpler way
function simpleLog(message, groupName, severity, facility)
{
  Homey.flow.runFlowCardAction(
    {uri:'homey:flowcardaction:homey:app:nl.nielsdeklerk.log:Input_group_log',
     id:'homey:app:nl.nielsdeklerk.log:Input_group_log',
     args: {log:message, 
            group:groupName,
            severity:severity,
            facility:facility} });
}

//Call SimpleLog with the message to be logged.
simpleLog("Test message", "Test Group","Alert","127.0.0.1");

I leave the print of the log with the sent message:

2 Likes

Yeah that’s indeed a way to do it, but it’s the flow card emulator.

For Severity and Facility you ought to use these numbers:

// Facility: 0 kernel, 1 user, 2 mail, 3 system, 4 authorisation, 5 syslog,
/// 6 LPR, 7 News, 8 UUCP, 9 Cron, 10 Deamon, 11 FTP, 12 NTP,
/// 13 Security, 14 Console, 15 Clock, 16 Flow, 17 Device,
/// 18 App, 19 Scene, 20 Trigger, 21 Condition, 22 Action
// Severity: Emergency=0 Alert=1 Critical=2 Error=3 Warning=4 Notice=5 Informational=6 Debug=7


I’m also trying to write to the logs, by using
PUT api/app/nl.nielsdeklerk.log/addlog

but all i got is errors too (@Arie_J_Godschalk : what’s the secret to PUT logs per API please?)

I got:
‘unauthorized’
or
Promise { <pending> }
or
Promise { <rejected> TypeError: Only absolute URLs are supported

Script trial:

//const URL = "https://192-168-1-7.homeylocal.com/api/app/nl.nielsdeklerk.log/addlog";
const URL = "http://192.168.1.7/api/app/nl.nielsdeklerk.log/addlog";
//const URL = "/api/app/nl.nielsdeklerk.log/addlog";

const myLogData = {
    'log':'Test 1,2,3',
    'group':'TEST',
    'facility':18,
    'severity':6
    };

await fetch(URL,{
	method: 'PUT',
	headers: {
	'Content-Type':'application/json'
	},
    mode: 'no-cors', 
	body: JSON.stringify(myLogData)
    });

return true;