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

Confused on configuration of retention Rolling Log files #199

Open
ajnh opened this issue Aug 3, 2018 · 0 comments
Open

Confused on configuration of retention Rolling Log files #199

ajnh opened this issue Aug 3, 2018 · 0 comments

Comments

@ajnh
Copy link

ajnh commented Aug 3, 2018

Hi
Sorry to be a pain.

Confused about how to configure the Rolling Log file appender specifically around aged retention. The examples pretty much all use 'daily'; and the comments indicate 'weekly' and 'monthly' as well. Whilst 'weekly' will be OK for some environments, in others we wanted a custom period, e.g. 2 days. Based on the comments of logging/appenders/RollingFile (rolling_file.rb), it suggests the age in seconds. Consequently, I configured the age as 60 * 60 * 24 * 2 (60 sec * 60 mins * 24 hrs * 2 days). However, 4 days later and the original logs are still around.

I'm a relative newbie to Ruby, so whilst I tried to trace the code and figure it out myself, what I am seeing is only the rolling of the log.

So, I'm thinking that whilst I have this configuration

    # Rolling log file, keeping 7 days worth, each sized up to 50 Mb
    Logging.appenders.rolling_file \
      'all',
      :filename => log_path_name.to_s,
      :level    => :debug,
      :roll_by  => 'date',
      :size     => config.all_log_max_size,    # 50G 50 * 1024 * 1024
      :age      => config.all_log_retention_age,    # 60 * 60 * 24 * 2
      :layout   => layout

this is actually saying role when it hits 50G or 2 days, rather than what I thought it was - role when it hits 50G and remove when its 2 days old.

Whilst the Rolling File implementation says the keep is number of logs, the confusion was seeded in the Logging::Logging (logging.rb) - keep = age = args.shift which implies that keep and age are synonymous.

Looked for some tests that might explain the behaviour, but couldn't see any.

So, a/ is there a way to retain for a specific period; and if so, b/ can you advise how to effect that configuration or where I can find doco / example please?

Again apologies for asking dumb questions.
Andrew

PS: Great Ruby extension!

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

No branches or pull requests

1 participant