One of my pet peeves is when I see someone doing the equivalent of hammering in a nail with a screwdriver. You can do it but it’s going to be a whole lot more work and take a lot more time than using a hammer. The corollary to this is “when the only tool you have is a hammer, all problems look like nails.”
Doing it all in rules really isn’t simpler. It just means you don’t have to learn how to use another tool. IMHO, people are far better off in the long run spending a little but of time learning how to use the right tool for the job rather than forcing a less capable tool to do the job. Not only does the learning itself in-and-of-itself have value, but it gives you access to more tools in your toolbox which will make you faster and more efficient at solving any new problem that comes your way in the future.
openHAB is not and does not pretend to be all things to all people. It has it’s uses for which it excels (home automation) and uses for which it isn’t the best tool for the job (network monitoring) and it has uses for which it is really bad (looking through logs). It doesn’t make anything simpler when trying to use a tool for which there are better tools available.
In this case, watching logs, filtering logs, and searching through logs is something that has been done since before Unix was invented (the 1970’s).
less excel at this job. There are some newer variants (e.g. multitail) that add features but the core features of these nearly 50 year-old-commands is more than adequate in almost all cases.
Want to monitor all the devices on your network? Use Nagios or Zabbix or Fing or something like that.
Want to schedule a nightly backup? Use
crontab and a shell script instead of an OH Rule.
And if you want to look through logs, use
less (or their equivalent).
But I guess it all boils down to why you want these log entries isolated. If you just want to look in the file to see when they happened, why go through the pain of writing a new logger config when you can just issue the command:
grep -E "Deur_Atelier|Poort_Atelier" /var/log/openhab2/events.log | grep changed | less
Or, as is usually more useful, you can search through events.log to see those log statements in context.
Then to search for those lines type
It will highlight the lines and navigate using
n for next match and
N for previous match.
This lets you see the log statements in context (i.e. what events occurred immediately before and what events occurred immediately after) which is almost always more meaningful than seeing the log statements on isolation. Or if you really need to reduce what’s in events.log, change the logging configuration so events.log is more useful to you, don’t write it out to some other log file.
If you really do need them in a separate file, configure the logger to put them into a separate file. This will be more efficient in the long run.