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:

        rotate 12

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

Why I can’t increase the transmit power of my Wifi interface?

1  Asked on November 19, 2021 by christopher-shaju


compare available list with chosen ids in shell script

2  Asked on November 19, 2021 by user3696623


How do I gunzip to a particular directory?

2  Asked on November 19, 2021


How to blacklist built-in Kernel module 8250_pci

1  Asked on November 19, 2021 by mark2012


Input Output errors on disk drives

1  Asked on November 19, 2021 by yuanl


Linux X86_64 physical memory layout

1  Asked on November 19, 2021 by franc-m


feh keys configuration not working

1  Asked on November 19, 2021 by ma08


slow Matlab on Ubuntu LTS and ZERO Swap

2  Asked on November 18, 2021 by waleed-shawki


Save all the terminal output to a file

3  Asked on November 18, 2021 by user78927


CentOS: Wireless adapter not found

0  Asked on November 17, 2021 by mohit-singh


cmd nested in backticks processed from sudo?

1  Asked on November 17, 2021 by alecxs


Ask a Question

Get help from others!

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