AnswerBun.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!

Related Questions

iptables forwarding not working

1  Asked on January 23, 2021 by eugene-smith

   

No devices for “nmcli connection show “

0  Asked on January 22, 2021 by kylie

   

How to get KWin-like window snapping in Xfce?

1  Asked on January 22, 2021 by bluekingwhite

         

Out of disk space error when trying to write to frame buffer

0  Asked on January 21, 2021 by novicefedora

 

How to build a chroot using docker?

2  Asked on January 20, 2021 by wimateeka

   

Telnet connection to Debian machine refused

1  Asked on January 20, 2021 by hakk

       

Unable to mount using mount.cifs command

1  Asked on January 19, 2021 by sk23

   

Problem: My terminal settings are not saved

0  Asked on January 19, 2021 by sagi-aizenman

   

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir