How to not display all persisted item history values

Hello,

Please let me know what can I do to not display all the lines that I got in the custom log file generated by Logging Persistent. I have the next configuration:

logging.persist:
Strategies {
// if no strategy is specified for an item entry below, the default list will be used
default = everyChange
}
Items {
allTemperatures* -> "allTemperatures"
AllItems* -> "AllItems
}

openhab.cfg configuration :slight_smile:
…
logging:pattern=%date{ISO8601} - %-25logger: %msg%n
…

Output of AllItems.log file

2016-03-30 11:13:56,364 - Dimmer_IarinaRoom_LEDs : 0
2016-03-30 11:13:56,375 - Switch_IarinaRoom_LEDs : OFF
2016-03-30 11:13:57,331 - IarinaRoom_LEDs_Power : 24.6
2016-03-30 11:13:58,334 - IarinaRoom_LEDs_Power : 0.3
2016-03-30 11:14:50,353 - Movement : OPEN
2016-03-30 11:16:40,453 - Movement : CLOSED
2016-03-30 11:16:40,810 - Movement : OPEN
2016-03-30 11:17:24,664 - Movement : CLOSED
2016-03-30 11:17:48,818 - Lux : 189
2016-03-30 11:18:58,446 - IarinaRoom_LEDs_Power : 0
2016-03-30 11:20:22,761 - Movement : OPEN
2016-03-30 11:20:53,640 - Movement : CLOSED
2016-03-30 11:23:45,738 - Movement : OPEN
2016-03-30 11:24:26,688 - Movement : CLOSED

So I want to not colect the lines with value “0” (e.g 2016-03-30 11:18:58,446 - IarinaRoom_LEDs_Power : 0) and lines with “CLOSED”.

Thank you,
Marian

As far as I can tell the Logging Persistence work like all other persistence providers and does what one would expect from persistence and saves ALL state changes to an Item. So you either need to make it so those Items do not get set to 0 or CLOSED, you need to manually persist only the changes you want persisted using Rules, or whatever it is that you are using this file for need to ignore those lines or run a preprocessor (e.g. grep) before reading the file in.

The Rules solution would be to take out the Items from your logging.persist file so they do not automatically get saved and write a rule for each Item.

rule "Persist Movement OPENED"
when
    Item Movement received command OPENED
then
    Movement.persist("logging")
end

rule "Persist Dimmer_IarinaRoom_LEDs"
when
    Item Dimmer_IarianaRoom_LEDs
then
    if((Dimmer_IarianaRoom.state as DecimalType) != 0) Dimmer_IarianaRoom_LEDs.persist("logging")
end