[systemd-devel] Append to logfile with year-month

Cecil Westerhof cldwesterhof at gmail.com
Thu Aug 24 07:48:59 UTC 2023


In a service file I can use:
    StandardOutput=append:/var/log/root/aptCacheUsage.log

but I want to use something like:
    StandardOutput=append:/var/log/root/aptCacheUsage_$(date +%%Y-%%m).log

Did does not work, because this puts it in:
    /var/log/root/aptCacheUsage_$(date +%Y-%m).log

Is there a way I can put it in:
    /var/log/root/aptCacheUsage_2023-08.log

while it would automatically next month go into:
   /var/log/root/aptCacheUsage_2023-09.log

I could of-course put it into:
    /var/log/root/aptCacheUsage.log

and at the beginning of the month move it if it exists with a timed
service, but I really would not like that kind of solution.

-- 
Cecil Westerhof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20230824/e41076a5/attachment.htm>


More information about the systemd-devel mailing list