OZW_Log.txt getting big

My Zwave log keeps expanding with my apprx 30 zwave devices. Is there a way to disable logging every zwave detail? Or would it be possible to move the logfile to a backup dir every now and then, for example using an automation?

I created a .sh file with this command:

mv -f OZW_Log.txt ./archive/OZW_Log.txt

then I defined this in configuration.yaml

shell_command:
  cleanlog: ./cleanlog.sh

And finally created an automation:

- id: '1234'
  alias: clean the log                              
   initial_state: true
   trigger:
   - platform: time
     at: "00:00:00"
  action:
  - service: shell_command.cleanlog

But is does’n seem to work because the data element is missing for the action. (what should I define as data element to call a shell script?)

edit options.xml and set

<Option name="logging" value="false" />

You don’t have to stop the logging completely. If you prefer, you can choose a log level in options.xml - see Open ZWave Config Options. I have mine set to 4 (warning or higher) like this:

< **Option** name="logging" value="true" />
< **Option** name="SaveLogLevel" value="4" />
1 Like

Additionally, if you want to rotate the log. You are probably better off doing it outside of HA using the OS native logrotate utility. Instead of an automation (IMO)

https://linux.die.net/man/8/logrotate

Create a file like /etc/logrotate.d/openzwave

/home/homeassistant/.homeassistant/OZW_Log.txt {
  daily
  missingok
  rotate 5
  compress
  notifempty
  create 0644 homeassistant homeassistant
}
1 Like