LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-21-2010, 03:35 AM   #1
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
Rotate log exactly at 12:00 Midnight


Hi All,

I have written a script to rotate zabbix logs.

Code:
cat /etc/logrotate.d/zabbix
/var/log/zabbix/zabbix_server.log {
daily
create
rotate 10
missingok
}
This is rotating logs daily at 04:02 AM. It is not set anywhere in the configuration.

I would like to rotate the logs at 12:00 Midnight. Do I need to change the time stamp of recent log file to 12:00 AM to make it work rotate today midnight.

Which time do i need to change access time, change time, modification time ?

Is there any other way to achieve this ?

Thanks

Last edited by vinaytp; 09-21-2010 at 03:41 AM.
 
Old 09-21-2010, 03:44 AM   #2
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by vinaytp View Post
Hi All,

I have written a script to rotate zabbix logs.

Code:
cat /etc/logrotate.d/zabbix
/var/log/zabbix/zabbix_server.log {
daily
create
rotate 10
missingok
}
This is rotating logs daily at 04:02 AM. It is not set anywhere in the configuration.

I would like to rotate the logs at 12:00 Midnight. Do I need to change the time stamp of recent log file to 12:00 AM to make it work rotate today midnight.

Which time do i need to change access time, change time, modification time ?

Is there any other way to achieve this ?

Thanks
Yes the logrotation entry is here.

Code:
/etc/crontab
Here the logrotate script is in
Quote:
/etc/cron.daily
and the
Quote:
/etc/crontab
rotates the log at 4:02 am. This entry is also there.

If ypu want to rotate the log daily at 12 am you can change in
Quote:
/etc/crontab
 
Old 09-21-2010, 04:04 AM   #3
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,143
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Hi,

Why you to to log rotation only at 12 it should be done periodically i mean daily,weekly ....

follow this superb link for syslog and log rotate

http://www.linuxhomenetworking.com/w...ux_with_syslog
 
1 members found this post helpful.
Old 09-21-2010, 04:13 AM   #4
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Original Poster
Rep: Reputation: 55
Thanks divyashree !!

It helped me to resolve my issue.
 
Old 09-21-2010, 04:27 AM   #5
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by vinaytp View Post
Thanks divyashree !!

It helped me to resolve my issue.
You are welcome. Please markk the post solved.
 
  


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
Log Rotate Configuration on Apache 2.2.15 raj.mahanty@ismt.co.in Linux - Networking 1 09-14-2010 05:10 PM
how to rotate auth.log MrUmunhum Linux - General 3 03-03-2010 07:03 PM
how to shrink and manually rotate log bangsters Linux - General 9 09-20-2009 01:57 PM
cannot delete or rotate messages log file dan451 Linux - Newbie 14 08-04-2006 04:13 PM
Log Rotate MaverickApollo Linux - Software 3 01-19-2004 12:12 AM


All times are GMT -5. The time now is 09:20 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration