LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-30-2015, 01:12 PM   #1
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Rep: Reputation: 17
Unhappy how to make logrotate to rename file in old style _log.1


Hi guys,

Do you know how to make logrotate 3.8.6 to rename files like old one?
Now it renames with date on the end. I want to add just numbers 1,2,3...

My script for httpd is:

Code:
/var/log/httpd/*log {
    daily
    missingok
    notifempty
    sharedscripts
    postrotate
        /etc/rc.d/init.d/httpd reload > /dev/null 2>/dev/null || true
    endscript
}
 
Old 03-30-2015, 01:33 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Distribution: Slack 10.2, CentOS 4.x / other?
 
Old 03-30-2015, 02:07 PM   #3
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
Sorry.
Long time didnt come here.
OS is CentOS 7.0
 
Old 03-30-2015, 05:19 PM   #4
ljb643
Member
 
Registered: Nov 2003
Posts: 528

Rep: Reputation: Disabled
I have the same, logrotate-3.8.6, and it does not put the date on the end by default. According to the docs, it won't do that unless you have "dateext" in the configuration file. So check you configuration files again.
 
Old 03-31-2015, 02:50 AM   #5
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
Hi mate,

It looks like logrotare doesnt read the files in /etc/logrotate.d/
Because in my httpd file i have: daily
but the log is not from yesterday but 2 days before:
forum-access_log-20150328

Any ideas what is wrong?
 
Old 03-31-2015, 03:03 AM   #6
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
I ran it manually:

# logrotate -s /var/log/logstatus /etc/logrotate.conf
# cat /var/log/logstatus
logrotate state -- version 2
"/var/log/yum.log" 2015-3-31-10:0:0
"/var/log/httpd/private-error_log" 2015-3-31-10:0:0
"/var/named/data/named.run" 2015-3-31-10:0:0
"/var/log/httpd/forum-access_log" 2015-3-31-10:0:0
"/var/log/httpd/error_log" 2015-3-31-10:0:0
"/var/log/wtmp" 2015-3-31-10:0:0
"/var/log/chrony/*.log" 2015-3-31-10:0:0
"/var/log/spooler" 2015-3-31-10:0:0
"/var/log/httpd/private-access_log" 2015-3-31-10:0:0
"/var/log/btmp" 2015-3-31-10:0:0
"/var/log/xferlog" 2015-3-31-10:0:0
"/var/log/httpd/bg-error_log" 2015-3-31-10:0:0
"/var/log/maillog" 2015-3-31-10:0:0
"/var/log/wpa_supplicant.log" 2015-3-31-10:0:0
"/var/log/secure" 2015-3-31-10:0:0
"/var/log/httpd/forum-error_log" 2015-3-31-10:0:0
"/var/log/httpd/bg-access_log" 2015-3-31-10:0:0
"/var/log/ppp/connect-errors" 2015-3-31-10:0:0
"/var/log/messages" 2015-3-31-10:0:0
"/var/log/cron" 2015-3-31-10:0:0
"/var/account/pacct" 2015-3-31-10:0:0
"/var/log/httpd/access_log" 2015-3-31-10:0:0
"/var/log/vsftpd.log" 2015-3-31-10:0:0


Update:

Just saw that logs were rotated.
But instead:
forum-access_log to become forum-access_log.1

the result is:
forum-access_log
forum-access_log-20150328

Last edited by masterross; 03-31-2015 at 03:08 AM.
 
Old 03-31-2015, 05:14 AM   #7
masterross
Member
 
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107

Original Poster
Rep: Reputation: 17
I just realized that in CeontOS 7.0 is used Systemd.
Maybe this is the problem?
Any help will be glad.
 
  


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
sendmail _log sanalbabu Linux - General 4 08-28-2013 06:55 AM
[SOLVED] How does logrotate use its status file? lastflight Linux - Newbie 2 05-30-2013 03:54 AM
Shell script to get name of file, delete original file, rename blank file chrisgti Linux - General 11 09-15-2012 02:49 AM
Can I rename a library to make it work? BobNutfield Slackware 7 05-15-2012 03:21 PM
make kde3 theme match with kde4 style almatic Linux - Desktop 0 03-11-2009 12:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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