I just setup the exec binding to monitor my UPS. The output of the command is going into the OpenHAB logs. So frontail is now nothing but a million lines of raw UPS data. I want it to only log errors. I tried log:set ERROR org.openhab.binding.exec
but that didn’t help.
I think you can direct to its own file and stop the general logging
If you can direct it to a file that means you should be able to direct it to the /dev/null bitbucket.
See this one:
I use that to “turn off” some events
Hi @Pedals2Paddles
did you find a solution?
I have the same problem and my logs contains thousands of lines of UPS raw data.
Have you tried the solutions mentioned in this thread?
Hi @Bruce_Osborne.
Thanks for your reply.
The solutions mentioned in this thread are workarounds that need quite advanced knowledge of the system in order to work properly.
Also, how can I be sure that the changes made in the log4j2 package will survive an upgrade? And how can they backed up for system recovery?
What was requested from the OP was a solution to avoid that the exec binding echoes the command line and the result in the log.
Configuring a log file isn’t remotely close to “advanced knowledge”.
However, when you’re objecting to something being logged, it’s a good idea to show an example.
@namraccr
You are right sorry…
THINGS FILE:
Thing exec:command:apc [command="/sbin/apcaccess -u", interval=60, timeout=2, autorun=false]
items FILE:
String APC_Raw { channel="exec:command:apc:output" }
String APC_APC (gAPC)
DateTime APC_DATE (gAPC)
String APC_HOSTNAME (gAPC)
String APC_VERSION (gAPC)
String APC_UPSNAME (gAPC)
String APC_CABLE (gAPC)
String APC_DRIVER (gAPC)
String APC_UPSMODE (gAPC)
DateTime APC_STARTTIME (gAPC)
String APC_MODEL (gAPC)
String APC_STATUS (gAPC)
Number APC_LINEV (gAPC)
Number APC_LOADPCT (gAPC)
Number APC_BCHARGE (gAPC)
Number APC_TIMELEFT (gAPC)
Number APC_MBATTCHG (gAPC)
Number APC_MINTIMEL (gAPC)
Number APC_MAXTIME (gAPC)
String APC_SENSE (gAPC)
Number APC_LOTRANS (gAPC)
Number APC_HITRANS (gAPC)
Number APC_ALARMDEL (gAPC)
Number APC_BATTV (gAPC)
String APC_LASTXFER (gAPC)
Number APC_NUMXFERS (gAPC)
Number APC_TONBATT (gAPC)
Number APC_CUMONBATT (gAPC)
DateTime APC_XOFFBATT (gAPC)
String APC_SELFTEST (gAPC)
String APC_STATFLAG (gAPC)
String APC_SERIALNO (gAPC)
DateTime APC_BATTDATE (gAPC)
Number APC_NOMINV (gAPC)
Number APC_NOMBATTV (gAPC)
Number APC_NOMPOWER (gAPC)
String APC_FIRMWARE (gAPC)
RULES FILE:
rule "APC: Parse raw output from command-line tool"
when
Item APC_Raw changed
then
...
Here is the output in my logfile repeated every minute:
2019-12-24 10:36:55.655 [vent.ItemStateChangedEvent] - APC_Raw changed from APC : 001,037,0936
DATE : 2019-12-24 10:35:54 +0100
HOSTNAME : XXX
VERSION : 3.14.12 (29 March 2014) debian
UPSNAME : APC
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2019-11-30 18:49:02 +0100
MODEL : Back-UPS XS 950U
STATUS : ONLINE
LINEV : 244.0
LOADPCT : 3.0
BCHARGE : 100.0
TIMELEFT : 138.5
MBATTCHG : 5
MINTIMEL : 3
MAXTIME : 0
SENSE : Medium
LOTRANS : 155.0
HITRANS : 280.0
ALARMDEL : 30
BATTV : 13.4
LASTXFER : Low line voltage
NUMXFERS : 10
XONBATT : 2019-12-22 17:00:26 +0100
TONBATT : 0
CUMONBATT: 3135
XOFFBATT : 2019-12-22 17:00:28 +0100
SELFTEST : NO
STATFLAG : XXX
SERIALNO : XXX
BATTDATE : 2017-09-27
NOMINV : 230
NOMBATTV : 12.0
NOMPOWER : 480
FIRMWARE : 925.T2 .I USB FW:T2
END APC : 2019-12-24 10:35:55 +0100 to APC : 001,037,0936
DATE : 2019-12-24 10:36:54 +0100
HOSTNAME : XXX
VERSION : 3.14.12 (29 March 2014) debian
UPSNAME : APC
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2019-11-30 18:49:02 +0100
MODEL : Back-UPS XS 950U
STATUS : ONLINE
LINEV : 248.0
LOADPCT : 3.0
BCHARGE : 100.0
TIMELEFT : 138.5
MBATTCHG : 5
MINTIMEL : 3
MAXTIME : 0
SENSE : Medium
LOTRANS : 155.0
HITRANS : 280.0
ALARMDEL : 30
BATTV : 13.5
LASTXFER : Low line voltage
NUMXFERS : 10
XONBATT : 2019-12-22 17:00:26 +0100
TONBATT : 0
CUMONBATT: 3135
XOFFBATT : 2019-12-22 17:00:28 +0100
SELFTEST : NO
STATFLAG : XXX
SERIALNO : XXX
BATTDATE : 2017-09-27
NOMINV : 230
NOMBATTV : 12.0
NOMPOWER : 480
FIRMWARE : 925.T2 .I USB FW:T2
END APC : 2019-12-24 10:36:55 +0100
2019-12-24 10:36:55.760 [vent.ItemStateChangedEvent] - APC_DATE changed from 2019-12-24T10:35:54.000+0100 to 2019-12-24T10:36:54.000+0100
2019-12-24 10:36:56.064 [vent.ItemStateChangedEvent] - APC_LINEV changed from 244.0 to 248.0
2019-12-24 10:36:56.516 [vent.ItemStateChangedEvent] - APC_BATTV changed from 13.4 to 13.5
So the exec binding is not logging its output. You are changing the state of an item and that state change event is being logged in the events log.
So we’re back to the original answer: configure the logging to filter out these events.
Alternatively, you might be able to pipe the output of the command to a file instead of assigning it to an item, then parse that output separately.
How can I do that?
Search the forum for filtering log
Or, you know, just click the link @vzorglub provided back in October…
You expect them to READ a thread before posting??
I believe in Christmas miracles
Dear @Bruce_Osborne
Before writing my request for help, I have read the link provided by @vzorglub but I didn’t understand how I could filter the log.
I was under the impresison that the forum was supposed to help people to find solutions.
Why do you think I haven’t read the post before posting?
And why is it so funny?
We are helping you help yourself.
We volunteers and can’t spoon feed everyone. The link posted above provides you with the solution to your problem in the first 4 posts.
Try it
If it doesn’t work come back here with what you tried
You didn’t tell us what you tried but only what you wanted to achieve so we helped…
We are volunteers. This is not a helpdesk.
@vzorglub
I know that you are volunteers and enthusiast users, and I appreciate your work.
I myself am a volunteeer in another forum.
I am not forcing anyone to reply to my requests, but what I didn’t like was the fact that someone was making fun of me.
Will try to read harder the link you sent me and in case come back here.