Hi my log grows about 20MB a day, I know can reduce it but nevertheless I wish to ideally keep a maximum size (first entries automatically deleted and replaced) if that’s impossible then automatically delete it when reaches, let’s say, 500Mb.
I know I can stop home assistant, delete it, and then restart home assistant, but wish to not have to think about it and automate the process.
You can think whatever you want but the source code clearly indicates the default is 50. That means if you don’t supply a value for max_entries the component will use 50.
2019-06-01 19:14:50 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.automation_ran. Service not found for call_service at pos 2: (ServiceNotFound(...), 'Service notify.filed_automations not found')
2019-06-01 19:14:50 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.automation_ran. Service not found for call_service at pos 2: (ServiceNotFound(...), 'Service notify.filed_automations not found')
2019-06-01 19:14:55 ERROR (SyncWorker_15) [homeassistant.components.opengarage.cover] Unable to connect to OpenGarage device: HTTPConnectionPool(host='192.168.1.171', port=80): Max retries exceeded with url: /jc (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff73a0ddf28>: Failed to establish a new connection: [Errno 113] Host is unreachable'))
2019-06-01 19:15:00 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.sensor_values_to_file. Unknown error for call_service at pos 1:
Because I have 5000+ of those after 5 hours from deleting the log and restart (now 4Mb big). My configuration is now
system_log:
max_entries: 500
so far seems same behaviour as when I hadn’t system_log in my configuration file
The system_log has nothing to do with the home-assistant.log, it’s just some extention to see some (unwanted for me) log entries on the info page.
If you want to tune the log, take a look here, but there’s nothing about the size and purging.
Well I thought the title was clear: yes I am talking about the file home-assistant.log which becomes too big, and wish to control its size in an automatic way
In my case, I have no logger entry in configuration.yaml. Nevertheless, there is a home-assistant.log file and it’s about 82 Kb. Whatever I see in there is also found in /var/log/syslog.
The home-assistant.log file is automatically purged after every restart whereas the duplicated entries in syslog are retained.
Anyway, that’s how it works on my system (version 0.89 in a venv).
Unfortunately I am on HASSIO, now the log is 10Mb (was 3MB) this afternoon), I really do not care about its content, just wish to max its size automatically
I’m still don’t get why you want to have its size set to max if you don’t care about the file? Hass.io relies on SD card writes so imho it’s logical to keep HA’s log file to a min.
Then you’d have to make a shell command that checks the size of HA log, then wipes it if it’s over a certain size. If you’re OK with linux commands this shouldn’t be too hard.
Finally you can set an automation in HA to run the command once per hour for example.
Good luck
EDIT: It would be nice if you could set the ‘logger’ component to have a max number of entries, something similar to ‘logrotate’
It seems like missing functionality to not be able to manually purge the HA logs. Or at least a good feature to add.
In my case I created a huge amount of HA logs while debugging and setting up a couple of scripts and automations. Firstly it is a pain to scroll down to the bottom of the file each time I want to see what went wrong. And now that I’m done, I want to get rid of all the crap, clear the logs and start fresh.
Sure I can write a script to truncate the file in Linux, but for the same reason someone decided it’s valid to expose a service to clear the system logs, they can also create/expose a service to clear the HA logs.