Skip to content

Rotating file logger #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Rotating file logger #71

wants to merge 6 commits into from

Conversation

maximevanhees
Copy link

@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
1 participant