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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-30-2015, 01:12 PM
|
#1
|
Member
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107
Rep:
|
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
}
|
|
|
03-30-2015, 01:33 PM
|
#2
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep: 
|
Distribution: Slack 10.2, CentOS 4.x / other?
|
|
|
03-30-2015, 02:07 PM
|
#3
|
Member
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107
Original Poster
Rep:
|
Sorry.
Long time didnt come here.
OS is CentOS 7.0
|
|
|
03-30-2015, 05:19 PM
|
#4
|
Member
Registered: Nov 2003
Posts: 528
Rep: 
|
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.
|
|
|
03-31-2015, 02:50 AM
|
#5
|
Member
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107
Original Poster
Rep:
|
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?
|
|
|
03-31-2015, 03:03 AM
|
#6
|
Member
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107
Original Poster
Rep:
|
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.
|
|
|
03-31-2015, 05:14 AM
|
#7
|
Member
Registered: Nov 2005
Distribution: CentOS 7.x
Posts: 107
Original Poster
Rep:
|
I just realized that in CeontOS 7.0 is used Systemd.
Maybe this is the problem?
Any help will be glad.
|
|
|
All times are GMT -5. The time now is 12:01 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|