Skip to content

Conversation

@maximevanhees
Copy link
Contributor

@maximevanhees maximevanhees commented Oct 17, 2024

The logs of services can now also be written to file by using the log: file and log_file: log_filename.txt options in the <service>.yaml file.

Example: /etc/zinit/example.yaml:

exec: sh -c "echo 'writing example log line'"
log: file
log_file: "log.txt"

This will create a log.txt file in the /var/log/zinit/<service_name>/ directory. At this moment a log file can be at max 1MiB in size. If the size of the log exceeds this threshold, the file is moved to log_<datetime>.txt file. There can be a maximum of 5 rotation files, this to keep the disk usage to a minimum.

Note: even when using the log: file option, the logs from the service can still be accessed through the zinit log command as well.

Closes #68.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

logging to filesystem

2 participants