LinuxQuestions.org
Review your favorite Linux distribution.
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 02-23-2012, 07:14 AM   #1
suprstar
Member
 
Registered: Aug 2010
Location: Atlanta
Distribution: ubuntu, debian
Posts: 142
Blog Entries: 2

Rep: Reputation: 23
rsyslog and log rotate problem


I have an Ubuntu 10.0.4 LTS server running as my syslog server for all my devices that can use it.

in /etc/rsyslog.d/50-default.conf I added these lines at the top:

Code:
:msg, contains, "atl1-wichorus" /var/log/wic1.atl.log
:msg, contains, "atl2-wichorus" /var/log/wic2.atl.log
:msg, contains, "jax1-wichorus" /var/log/wic1.jax.log
:msg, contains, "jax2-wichorus" /var/log/wic2.jax.log
incoming messages are directed to the proper log files. The problem is when the files rotate - /var/log/wic1.atl.log becomes /var/log/wic1.atl.log.1 like it's supposed to, and a new 0-byte /var/log/wic1.atl.log is created. However, syslog writes new messages to the /var/log/wic1.atl.log.1 file. Since the new /var/log/wic1.atl.log is always 0 bytes, it never gets rotated again.

I have a file in /etc/logrotate.d that contains:

Code:
/var/log/wic*.log {
        daily
        missingok
        rotate 8
        compress
        delaycompress
        notifempty
        create 640 root adm
        endscript
        postrotate
                reload rsyslog >/dev/null 2>&1 || true

}
So these files only start writing to the new file if I restart syslog.

Code:
-rw-r-----  1 root      adm             0 2012-02-16 04:37 wic1.atl.log
-rw-r-----  1 syslog    adm    4936864679 2012-02-23 08:14 wic1.atl.log.1
-rw-r-----  1 syslog    adm      35695955 2012-02-15 11:59 wic1.atl.log.2.gz
-rw-r-----  1 syslog    adm      29216126 2012-02-14 08:31 wic1.atl.log.3.gz
-rw-r-----  1 syslog    adm     174011677 2012-02-13 09:13 wic1.atl.log.4.gz
-rw-r-----  1 syslog    adm       2426022 2012-02-08 11:01 wic1.atl.log.5.gz
-rw-r-----  1 syslog    adm      24951368 2012-02-02 11:08 wic1.atl.log.6.gz
I even added "/etc/init.d/rsyslog restart" to the logrotate script, and that didn't work either! It does when I do it on a command line.. What am I missing here?

Last edited by suprstar; 02-23-2012 at 07:17 AM.
 
Old 02-23-2012, 11:37 AM   #2
pafoo
Member
 
Registered: Jul 2011
Location: Alabama
Distribution: Red Hat/Ubuntu/Solaris
Posts: 37

Rep: Reputation: 11
Take the * out of your logrotate conf file and specify each file to get rotated. See if that helps.
 
Old 02-24-2012, 04:29 AM   #3
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
The endscript is missing below the reload command (man logrotate). Also the “|| true” shouldn’t be necessary.
 
1 members found this post helpful.
Old 02-26-2012, 06:09 AM   #4
suprstar
Member
 
Registered: Aug 2010
Location: Atlanta
Distribution: ubuntu, debian
Posts: 142

Original Poster
Blog Entries: 2

Rep: Reputation: 23
Quote:
Originally Posted by Reuti View Post
The endscript is missing below the reload command (man logrotate). Also the “|| true” shouldn’t be necessary.
That was it, the 'endscript' was in the middle of the config, not at the end. Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Send syslog log to rsyslog server? is possible? JohnV2 Slackware 9 10-13-2011 01:37 PM
[SOLVED] I can send syslog log to rsyslog server? how? JohnV2 Linux - Server 6 10-13-2011 08:55 AM
How to config rsyslog on Fedora 10 to collect the log from Cisco ASA5510 ? gutiojj Linux - Server 2 03-30-2010 03:08 PM
how to write log data to disk when the server is down while using rsyslog prakash.akumalla Linux - Newbie 1 06-25-2008 01:15 AM
Log Rotate MaverickApollo Linux - Software 3 01-19-2004 12:12 AM

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

All times are GMT -5. The time now is 05:19 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