Skip to content

include directive can't use tilde #322

@dvzrv

Description

@dvzrv

Hi! I've tried using a systemd user unit for the setup of a per-user logrotate.

This seems to work fine, but the include directive seems to not accept tilde to resolve a directory.
When defaulting to some sort of XDG Base Directory Specification, we can assume, that e.g. ~/.config/logrotate.conf holds the per user configuration, and that we would be able to place per application configuration files to ~/.config/logrotate.d/.
However, this does not get resolved by the include:

including ~/.config/logrotate.d
error: cannot stat ~/.config/logrotate.d: No such file or directory

(but the directory exists and has a configuration snippet in it)

Using the rotate definitions directly in the configuration file works though (here with a sway log as an example):

rotating pattern: ~/.log/sway.log  weekly (4 rotations)
empty log files are not rotated, old logs are removed
considering log /home/dave/.log/sway.log
Creating new state
Now: 2020-05-15 09:43
Last rotated at 2020-05-15 09:00
log does not need rotating (log has already been rotated)

It would be really great if the include directive could also resolve tilde, as the only alternative is placing everything into one configuration file, or hard coding the include directory (which then is not portable to another system where e.g. the user name might be different).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions