LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-31-2014, 01:27 AM   #1
yzT!
Member
 
Registered: Jan 2013
Distribution: Debian
Posts: 168

Rep: Reputation: 2
Problem with the rotation of logs


I'm facing a problem with one of my servers related to the rotation of logs. When it reaches the log.2, it flushes all logs and stops logging unless I restart syslog.

For instance:

Mar 8 - secure
Mar 15 - secure.1
Mar 22 - secure.2
Mar 29 - previous logs lost and not logging anymore.

I manage like 50 servers and only this one is acting like this. What could be happening?
 
Old 03-31-2014, 02:10 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Check your logrotate settings are the same on this server.
Check your logs to see if syslog is failing at any point.
When you have to (re)start syslog is it actually running at the time.

As you haven't posted any of your logrotate settings relevant to that log that's about the only suggestions I can make.
 
Old 03-31-2014, 02:23 AM   #3
yzT!
Member
 
Registered: Jan 2013
Distribution: Debian
Posts: 168

Original Poster
Rep: Reputation: 2
Just noticed that this server had "rotate 2" while others had "rotate 4". That explains why the latest file with logs is the .2, however, that's not a reason to stop logging at all, it should start logging again in the first file.

Code:
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
    monthly
    create 0664 root utmp
    rotate 1
}

# system-specific logs may be also be configured here.
 
Old 03-31-2014, 02:32 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Ok, that's your logrotate config file, as you can see it includes files in /etc/logrotate.d you'll probably find a "syslog" file in there.

For reference on my CentOS 6.5 box this is:

Code:
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}
 
Old 03-31-2014, 03:13 AM   #5
yzT!
Member
 
Registered: Jan 2013
Distribution: Debian
Posts: 168

Original Poster
Rep: Reputation: 2
In the server where this is happening, I got no syslog file. Instead I have syslog-ng. Content is the same as the others, just changing syslog for syslog-ng.

Code:
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslog-ng.pid 2> /dev/null` 2> /dev/null || true
    endscript
}
 
Old 03-31-2014, 03:16 AM   #6
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Ok, that's fine and expected if you're using syslog-ng.

At least we've your 2 / 4 sorted, I'd still check your logs to see if there's any errors related to syslog(-ng) and also my comments about checking to see if syslog is actually stopped or "hung" next time it happens.
 
Old 03-31-2014, 04:07 AM   #7
yzT!
Member
 
Registered: Jan 2013
Distribution: Debian
Posts: 168

Original Poster
Rep: Reputation: 2
I cannot check the logs because they are empty after this happens.

I'm adding a sticky note to remember to check back in four weeks whether it's stopped or not after it reaches the final log.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Log rotation for my application logs parteekM Solaris / OpenSolaris 10 02-06-2012 12:55 PM
Log rotation for my application logs parteekM Solaris / OpenSolaris 5 02-04-2012 04:25 AM
[SOLVED] Log file rotation problem mgai7755 Linux - Newbie 10 04-21-2011 03:31 AM
Log file rotation problem aliweb Linux - Newbie 10 02-02-2011 07:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration