Simple LOG app - Former main topic [Deprecated]

SDK3 now in TEST:

4 Likes

Feature request (saves a lot of time).
Currently there are individual cards for logging to log, timeline or both.
Would it be possible to create a card with 2 boolean settings for log and timeline?
This way I can start with log+timeline and switch off the timeline after everything seems to be working fine with debugging my flows?
Example: Log to “timeline Y/N” and log “Y/N” in “groupname” the “data to log”.
Thanks
Roger

Thank you Arie - you seem to be a community life saver… Thumbs up!!

Great that you did the rewrite for SDK3.
Unfortunately, the CSV download still doesn’t work, not with the Chrome browser, and not even with the Fire-Fox browser. Also, I can’t select a part or the whole file to copy the content, is it possible for you to make these functions work, please? (yes, I use: Homey Developer Tools).

Yes, ill work on that, as soon as i can.

2 Likes

Just added to SimpleLog (in Test now):
A flowcard that retrieves the Log as an JSON token.

This way, you can save it through FTP or send it through an Email app.

image

2 Likes

Hi.

After the last update to 2.9.1, my logging from HomeyScript stopped working. The logs from flows still work. I log from HomeyScript like this:

let HomeyScript = await Homey.apps.getApp({ id: 'nl.nielsdeklerk.log' } );

HomeyScript.apiPut('addlog' , { log:'log_content', group: 'group_name'} );

Has there been any changes to this?

Regards,
Anders

Hey,

This is resolved in 2.9.4.
It’s in test/review now ( Simple LOG test version | Homey)

2 Likes

Don’t see the promised new Card in Homey web app / android mobile app.
image
yes I use v 2.9.4.

Solution: Use advanced flows as the picture shows!!!

1 Like

Since the card retrieves a token/tag, yeah, it’s advanced flows only.

1 Like

How can we RUN this script, wat do we need?
Can you make a short description for non-programmers please?

Hi,

With your new WebApi (v.2.9.4) I got the idea to write my app logging information into the SimpleLog. Unfortunately I had to find out that there is something wrong with the “addLog”, because when I call the “post” I always get the error message “Error: not_found”.

Code:

 post(path, body) {
    if (!this.isConnected) {
      return Promise.resolve(true);
    }

    this.debug(`post() > path: "${path}", body: ${JSON.stringify(body)}`);
    return this.#homeyApp.post(path, body)
      .catch((error) => {
        this.error(`post() > ${error}`);
        throw Error(error);
      });
  }

Console Log:

[log] 2023-01-11 07:27:27 [SarahHubApp] [DEBUG] SimpleLogApp > post() > path: "addlog", body: {"group":"Log","log":"[NOTIFY] SARAH.hub - v1.0.0 is running..."}
[err] 2023-01-11 07:27:27 [SarahHubApp] SimpleLogApp > post() > Error: not_found

Could you please check what this could be.

THX Chris

BDW: I use the same API (wrapper) with the “MQTT Client App” and there everything works fine:

[log] 2023-01-11 07:27:27 [SarahHubApp] [DEBUG] MqttClient > MqttClientApp > post() > path: "send", body: {"qos":0,"retain":false,"mqttTopic":"homey/test","mqttMessage":"Hallo Homey"}

According to the first post, the HTTP method to use is PUT, not POST.

1 Like

Me idiot, “Reading is a matter of luck” or “You can no longer see the forest for the trees”. :person_facepalming:

Was probably yesterday again a little too long working day…

Now it works…

THX Chris

I still have something and hope I don’t embarrass this time.

It would be a good idea if the SimpleLog app has a syslog interface, then you could forward the log directly to a central log server (eg Grafana Loki) ?

Chris

1 Like

Sure, ill look into it.

Please create a ticket at the support link in the app store. Thanks!

Made !!

THX Chris

@Peter_Kawa
Hey Peter,

Wanna see something neat?
You need to install the TEST version of Better Logic Library and TEST of the Simple Log.

(You logs will be converted, and while you can go back to the Live version apps, the “old log” will than be lost.)
But, please, test it and what’s the new setting screen!

O, and, Logs do not get removed at all currently.
This is because the whole log is now done through Filesystem, not in memory.
(and no, it’s not slow, i build and special indexes system for it).

2 Likes

Is there a way to automatically add simple log cards to all your flows?
Papertrails had a way for adding (and removing) these, but that doesn’t work anymore unfortunately.
Simple Log could be a great replacement then…

I am not sure that can be done anymore, and certainly not without the homey-api.

I don’t think so, i don’t connect with Papertrail at all, not sure how Papertrails works.

The idea for me was because of multiple feature requests to implement a Syslog interface.

I have worked very hard the last two weeks rebuilding the Simple Log app, so that it will not use Memory!

Because, as it stands right now, the new HP2023 is, for me, still a bitt low on memory, while i have about 6-7 GB of disk storage left unused.
I think this will be the case for a lott of users.

So, most apps bottleneck is it’s memory consumption.
That’s why i have also rewriten the whole basis of the SImple Log App.

Simple Log now “dumps” all logs in index-based files

When you access/retrieve the log, it will only request the data from disk that you require, running filters over the indexes before actually retrieving the text-based value parts of the.

Also, this is not done by parsing a json into a textfile.
Because that would mean a big file would take a lott of resources.

Here is how it works:

  • Each (UTC) date that logs a message to, a LogBook is created for it.
  • The LogBook identifier and filepath are stored in Memory adding just a few bytes(!) in memory every day!
  • Each LogBook contains an index file, containing only numbers in very short ways, one of which is the location/position of the text-values within the text-log-files.
  • And thuse each LogBook contains an text file which are filled with all text-values.
  • Also, groups/app-names are saved in memory (and in file ofc) and only index-numbers are added to the actual logfiles, reducing it’s sizes.

Now, you might be wondering: that must be slow, right?

Well, no.
I am no real Node.JS expert!
However, i do have a lott of experience with filesystems and manipulating and retrieve (usefull) data from (large) dataset/strings/streams.
And you just need to avoid basic “mistakes” like, needing to read a complete textfile, splitting it into an array by splitting the line-breaks.
That’s bad method when you might only need one or two records from a file containing f.i. 10.000 lines.
Now, i do use this for the day-log-indexes: each time you request data from the log (through the App Settings, Flowcards or AppApi) it will read the complete index file (if that day is part of the requested and not done yet etc.), run the supplied filters, requests the part of the text-files it needs and return the results.

Current test results:

Here i have created 100 records 365 days.
Meaning, the log-file contains 365 logbooks (total size on disk: 550kB).
Now, if i request f.i. 100 records from a year ago, it takes just a few hunderd milliseconds to fully request and display that data. At about 30 seconds in the video, i show Warnings from the last year: one each day.
Thuse, this video shows what it means to open 365 index files and read what is needed: in less then half a second!
(cannot insert an video here)
https://bitbucket.org/QlusterIT/nl.qluster-it.simplelog/downloads/recording-2023-02-21-08-42-15.webm

Simple (Sys) LOG

As requested through Feature requests:

  • You can now create Syslog clients, connecting Simple (Sys) LOG with it and send messages to the client.
    Configuration options are available, like, send all default notify messages through this specific client by default.
  • You can create (in dev, not test yet, today) multiple Syslog servers, letting other devices send Syslog messages directly to Simple (Sys) LOG without connecting through a special API or something, just through basic Syslog messages.
  • I have completly rebuild the App Settings, giving Syslog it’s Syslog (UI) interface:
    You can rotate the “screen” which works so nice on phones!

N.b. Anyone testing, please update to 2.9.9 to resolve a bug.

3 Likes