TransWikia.com

Custom logrotate with hostnames

Unix & Linux Asked by Gwynn on July 29, 2020

I have recently set up my central log server on CentOS 8, I had the following template on my main server:

$template RemoteMessages, "/var/log/%HOSTNAME%/messages"
$template RemoteSecure, "/var/log/%HOSTNAME%/secure"
$template RemoteCron, "var/log/%HOSTNAME%/cron"
$template RemoteEmerg, "/var/log/%HOSTNAME%/emerg"
$template RemoteBoot, "/var/log/%HOSTNAME%/boot.log"

*.info;mail.none;authpriv.none;cron.none        ?RemoteMessages
authpriv.*                                      ?RemoteSecure
cron.*                                          ?RemoteCron
*.emerg                                         ?RemoteEmerg
local7.*                                        ?RemoteBoot

Our hostnames have the same first 4-5 letters, e.g. SRVR% and such. I created a custom logrotate on /etc/logrotate.d/remote with the following configuration:

/var/log/SRVR*/*
{ 
        weekly
        rotate 12
        create
        dateext
        compress
}

But I get the following out put when running : sudo rsyslog -d -f /etc/rsyslog.d/remote

rotating log /var/log/SRVRPRXYP01/messages, log->rotateCount is 12
dateext suffix '-20200727'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
set default create context to system_u:object_r:var_log_t:s0
glob finding old rotated logs failed

This happens for each file within the folder. What am I doing wrong? Any help will be appreciated. Thank you.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP