tags:

views:

200

answers:

1

I looked at logrotate.conf examples and everything in my /etc/logrotate.d directory. Nowhere was I able to find documentation on variables in these files.

I am trying to create a config file for rotating the logs of an application we are writing. I want to set the directory where logs are stored once, and then use it as a variable, like so:

my_app_log_dir=/where/it/is/deployed/logs

${my_app_log_dir}/*.log ${my_app_log_dir}/some_sub_dir/*.log {
    missingok
    # and so on
    # ...
}

Is that possible?

A: 

Directly in the config file no (as far as my knowledge in logrotate goes).

Other solution:

  • Use the include option to include parts of the configuration file from a directory. This can help you if you have a package for your application, the package can leave a file in that directory containing only the entries for your app.
graffic