Arun Khan
2014-Aug-06 16:17 UTC
[CentOS] rsyslog does not log on a separate partition/FS mounted on /var/log/
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. [1] Disk /dev/xvda: 8589 MB, 8589934592 bytes Device Boot Start End Blocks Id System /dev/xvda1 * 1 64 512000 83 Linux /dev/xvda2 64 1045 7875584 8e Linux LVM Disk /dev/mapper/VolGroup-lv_root: 7205 MB, 7205814272 bytes Disk /dev/mapper/VolGroup-lv_swap: 855 MB, 855638016 bytes -- Arun Khan
Tony Mountifield
2014-Aug-06 16:50 UTC
[CentOS] rsyslog does not log on a separate partition/FS mounted on /var/log/
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