In oh console I can access the log files by log:display
But how can I print all WARN, ERROR, FATAL entries let’s say of the past 5 days?
I searched for a few hours but am not able to find any hint.
Could somebody please guide me in the right direction?
That does not answer my question. The question was how to access HISTORIC log data (those which are stored in the standard log directory of the PAST 5 days or so.
log:display (which I have already mentioned in my first post and which you are referring to) only returns the last few hours
I don’t think @Matze0211 is. Check the link again. The first subsection, before the console is even mentioned, tells you where the log files are located so you can access them directly, and interrogate with your favourite method.
I have not referred to log:display, I have referred to the log files that are physically stored on the harddisk of your openhab installation. Both is explained in the article that I have linked.
If you take a look into the log folder, you will see that there is not only an openhab.log file but also rolling logfiles with even older log entries.
Not sure for karaf log:display, but e.g. on fronttail you can configure the default amount of lines to show in the GUI.
But if you want to go back several days, for performance reasons it is maybe best to have a look into the file itself directly.
then I still probably do not see the forest for the trees.
log:display -l WARN only shows warnings of the past FEW HOURS, as it just reads OPENHAB.LOG and EVENTS.LOG.
This command does NOT show you the log entries of the past DAYS, which are stored in events.log.1 2 3 4 5 6 7 and openhab.log.1 2 3 4 5 6 7
As already stated in my post above I am already aware where the files are and that historic log files are kept in that directory
the question still remains if there is a command which prints all entries WARN, ERROR, FATAL from all files.
The question was not where I can find those files. And it does not solve my task to manually walk through those files.
If it does not work with log:display then the solution probably is a kind of bash script which iterates through all files and greps all warnings. If this is the case then I am interested in that command as I guess somebody already had that task as well
we all know that in openhab.log and events.log there are entries of just the last couple of hours so it should be clear that we are talking about archived log files, too (events.log.1 2 3 4 5 6 7, openhab.log.1 2 3 4 5 6 7)
I am just talking about a little help what the correct syntax of either log:display is (ok. understood, it does not have the option to include historic files) or any other command like cat grep whatever.
which will result in a script with 8 x 3 x 2 = 48 lines I am sure there is a one liner available with some foreach instruction to cycle through all log files. For that my little linux experience is not good enough. As said, maybe somebody else already had that requirement too and already found a solution.
Thanks for your constructive help.