Skip to content
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

Split log files by day or size (log rolling) #94

Closed
outstanding1301 opened this issue Sep 21, 2023 · 2 comments
Closed

Split log files by day or size (log rolling) #94

outstanding1301 opened this issue Sep 21, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@outstanding1301
Copy link

Feature Request

Split log files by day or size (log rolling)

Use Case:

  • Prevent the log file from becoming too large.
    • If the application is too talkative, there is a risk that the log file size will grow infinitely.
  • Effective log management.
    • Quick access to logs from a specific date.

Proposed Change:

in process-compose.yml

log_location: logs/log.txt
log_level: debug

to

log_location: logs  # it must be a directory
log_level: debug
log_rolling:
  format: log-{day}.txt  # or log-{index}.txt / log-{day}_{index}.txt ...
  day: 1  # Interval for rolling log files. [logs/log.txt-2023-09-21] [[logs/log.txt-2023-09-22] ... 
  size: 100MB  # File size for rolling files. [logs/log.txt-1] [logs/log.txt-2] ...

Who Benefits From The Change(s)?

People who will keep this application running for a long time.

Alternative Approaches

I think it would be great if this amazing app has more options to manage log.

@F1bonacc1 F1bonacc1 added enhancement New feature or request good first issue Good for newcomers labels Sep 22, 2023
@F1bonacc1
Copy link
Owner

Hi @outstanding1301

Thank you for creating this feature request.
I think it will be better to put a timestamp in the log file since we can't guarantee that the rotation size will create a file each {day}.
I will also add the same configuration to each process (optional and backward compatible):

log_rotation:
  max_size_mb: 1 # the max size in MB of the logfile before it's rolled
  max_age_days: 3 # the max age in days to keep a logfile
  max_backups: 3 # the max number of rolled files to keep
  compress: true # determines if the rotated log files should be compressed using gzip. The default is not to perform compression.

@F1bonacc1
Copy link
Owner

Added in v0.69.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants