LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 09-23-2017, 10:24 AM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
Getting apache to work with logrotate.


What is wrong with this logrotate configuration? It seems it doesn't like the * in the path/file name. And /bin/killall -HUP httpd doesn't seem to restart apache, to generate new logs if I rotate them manually.

Code:
domlogs]# logrotate --force /etc/logrotate.conf
error: /etc/logrotate.conf:41 unexpected log filename
error: found error in /etc/http/logs/*log /etc/http/domlogs/*.log , skipping
Code:
/etc/http/logs/*log /etc/http/domlogs/*.log {
    missingok
    daily
    size 10M
    maxage 60
    /bin/killall -HUP httpd
}
Thanks in advance.
 
Old 09-23-2017, 01:58 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Assuming CentOS from your profile...
You don't say what version of CentOS you're using, but pre 7, I have:
Code:
postrotate
    /sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
for the reload [note: it is not necessary to restart httpd, only to reload it]
for CentOS 7 it's:
Code:
postrotate
    /bin/systemctl reload httpd.service > /dev/null 2>/dev/null || true
endscript
Not sure what logrotate doesn't like about the filenames, unless that's not where the logfiles actually are. Mine are rotated happily with /var/log/http/*log [note: no '.']
 
Old 09-23-2017, 04:40 PM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
@OP

You get this error because your forgot to use postrotate/endscript when restarting the httpd daemon
Code:
/etc/http/logs/*log /etc/http/domlogs/*.log {
    missingok
    daily
    size 10M
    maxage 60
    postrotate
      /bin/killall -HUP httpd
    endscript
}
 
  


Reply



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
Logrotate without reloading Apache m@o_614 Linux - General 3 08-07-2017 03:54 PM
Can't get logrotate to work Riallin Linux - General 3 01-29-2010 03:15 AM
Apache logrotate kenmiles Linux - Server 2 08-13-2009 09:05 AM
logrotate does not work! mderakhs Linux - Server 1 09-15-2008 01:13 PM
Apache logrotate teeno Linux - Software 4 08-06-2003 10:51 PM

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

All times are GMT -5. The time now is 07:33 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
Open Source Consulting | Domain Registration