The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > Linux > Ubuntu
.
google unix.com



Ubuntu Ubuntu is a complete desktop Linux operating system, freely available with both community and professional support.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem seen with logrotate rsravi74 Red Hat 1 02-16-2009 08:19 AM
logrotate size limit modcan UNIX for Advanced & Expert Users 5 10-30-2008 09:13 AM
logrotate bug? jjinno UNIX for Advanced & Expert Users 0 06-09-2008 04:24 PM
Disabling logrotate primal UNIX for Dummies Questions & Answers 2 04-14-2008 01:19 PM
how to set size in logrotate.conf icehero UNIX for Dummies Questions & Answers 0 02-24-2008 04:41 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-11-2009
ktm ktm is offline
Registered User
  
 

Join Date: Aug 2009
Posts: 12
logrotate - why ignore size ?

Hi, i have a logroate script that works properly when running manually but otherwise it won't work.I put in in /etc/logrotate.d/nginx. I simply cannot understand why it won't run properly when run with a cronjob. It suppose to run hourly and rotate logs if they are > 3mb. What am i missing here ?:

Code:

/home/*/log/*log {
    hourly
    rotate 2
    dateext
    missingok
    notifempty
    create 0644 root webmasters
    sharedscripts
    postrotate
    size 3M
        kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
    endscript
}
My logrotate.conf
Code:
# see "man logrotate" for details
# rotate log files daily
daily

# keep 4 weeks worth of backlogs
rotate 4

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

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

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

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

/var/log/btmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 1
}

# system-specific logs may be configured here
  #2 (permalink)  
Old 10-11-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,839
Quote:
Originally Posted by ktm View Post
Hi, i have a logroate script that works properly when running manually but otherwise it won't work.I put in in /etc/logrotate.d/nginx. I simply cannot understand why it won't run properly when run with a cronjob. It suppose to run hourly and rotate logs if they are > 3mb. What am i missing here ?:
How do you know it's running properly when run manually? Did you check the output of either of these:
Code:
logrotate -d /etc/logrotate.conf # run in debug mode
logrotate -v /etc/logrotate.conf # run with verbose messages
Other than that I see 2 possible problems with your configuration:
Code:
/home/*/log/*log {
[...]
    create 0644 root webmasters
    sharedscripts
    postrotate
    size 3M
        kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
    endscript
}
Those 2 lines definitely have to be swapped.

logrotate.conf
Code:
[...]
# This doesn't belong in the global configuration, but in the
# per-log rules.
# create new (empty) log files after rotating old ones
create 0644 webmasters
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0