[CentOS] rsyslog does not log on a separate partition/FS mounted on /var/log/

Wed Aug 6 16:50:41 UTC 2014
Tony Mountifield <tony at softins.co.uk>

In article <CAHhM8gD+hFdUyy7uAH3KX2h37cA5fDbBWtJWYckV9Tp3_4nzQw at mail.gmail.com>,
Arun Khan <knura9 at gmail.com> wrote:
> The system is an AWS Instance based on a community CentOS 6.4 AMI snapshot.
> 
> The vdisk is as follows as shown below [1]
> The root LVM contains /var/log/
> 
> I have attached another block device with ext4 FS.
> 
> I copied the files from /var/log to this device (mounted on /mnt) and
> then changed
> /etc/fstab to mount this device on /var/log on boot.
> 
> However, I do not see anything being logged in /var/log/messages.
> To test the logging, I used the 'logger' command to log some string; nothing
> appears in /var/log/messages.
> 
> 'service rsyslog status' reports the daemon is running.
> 
> When I stop rsyslog, umount the /var/log device and then restart rsyslog, I can
> see that logs are being recorded in /var/log/messages.  Using the 'logger'
> command I can see messages written in /var/log/messages.
> 
> man pages of ryslog.conf and rsyslogd show nothing related to logs
> being on a separate device
> 
> Any pointers to fix the problem would be much appreciated.

Probably rsyslog is being started before /var/log is mounted, and so it
is opening files within /var/log on the root device.

When the second device gets mounted on /var/log, the files within the
original /var/log are no longer visible, but rsyslog still has open handles
to them.

You need to arrange for rsyslog to get restarted or HUPed after the mounting
of /var/log.

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org