LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-04-2018, 09:44 PM   #1
bentech4u
Member
 
Registered: Feb 2009
Posts: 41

Rep: Reputation: 1
Apache log rotate configuration


HI

i was trying to configure logrotate for my apache server and it's not working properly.

here is my lodrotate configuration

Code:
/var/log/httpd/*log {
    daily
    missingok
    notifempty
    sharedscripts
    compress
    delaycompress
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}
And here is the logs directory

Code:
-rw-r--r-- 1 root root         1 Dec  4 09:10 jk-runtime-status.5767.lock
-rwxrwxr-x 1 root root         0 Dec  5 03:23 ssl_request_log
-rwxrwxr-x 1 root root         0 Dec  5 03:23 ssl_error_log
-rwxrwxr-x 1 root root         0 Dec  5 03:23 ssl_access_log
-rwxrwxr-x 1 root root         0 Dec  5 03:23 rewrite.log
-rwxrwxr-x 1 root root         0 Dec  5 03:23 mod_jk.log
-rwxrwxr-x 1 root root         0 Dec  5 03:23 error_log
-rwxrwxr-x 1 root root         0 Dec  5 03:23 access_log
-rwxrwxr-x 1 root root      5274 Dec  5 04:19 ssl_error_log-20181205
-rwxrwxr-x 1 root root     47198 Dec  5 06:10 error_log-20181205
-rwxrwxr-x 1 root root  11131982 Dec  5 06:13 ssl_request_log-20181205
-rwxrwxr-x 1 root root   9037654 Dec  5 06:13 ssl_access_log-20181205
-rwxrwxr-x 1 root root 514548359 Dec  5 06:13 rewrite.log-20181205
-rw-r--r-- 1 root root      6080 Dec  5 06:13 jk-runtime-status.5767
-rwxrwxr-x 1 root root   7457352 Dec  5 06:13 mod_jk.log-20181205
-rwxrwxr-x 1 root root  57777013 Dec  5 06:13 access_log-20181205

as you can see log is rotated with date ext but apache is still writing logs to rotated file no to new files(new files size is 0 bytes)

Thanks & Regards,
Ben
 
Old 12-05-2018, 05:33 AM   #2
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
Hi,

You didn't mention your distro and version, but I guess you're using apache-2.2x as you have a separate rewrite.log.
If that's the case, following is a stock Centos-6 httpd logrotate script:
Code:
/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    delaycompress
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}
Regards
 
Old 12-05-2018, 09:34 AM   #3
bentech4u
Member
 
Registered: Feb 2009
Posts: 41

Original Poster
Rep: Reputation: 1
cannot do from http conf file as directory has 7 types of log files

i have changes conf file with

Code:
 /var/log/httpd/*log {
    daily
    missingok
    rotate 52
    compress
    delaycompress
    notifempty
    sharedscripts
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}
renamed all log files without date ext.

ran : logrotate -f /etc/logrotate.d/httpd

and it created log with.1 extension

Code:
drwxrwxr-x.  2 root root    4096 Dec  5 08:52 .
drwxr-xr-x. 16 root root    4096 Dec  3 13:39 ..
-rw-r--r--   1 root root  143348 Dec  5 08:52 access_log.1
-rw-r--r--   1 root root    3411 Dec  5 08:51 error_log.1
-rw-r--r--   1 root root    6080 Dec  5 08:52 jk-runtime-status.28481
-rw-r--r--   1 root root       1 Dec  5 08:49 jk-runtime-status.28481.lock
-rw-r--r--   1 root root   13395 Dec  5 08:52 mod_jk.log.1
-rw-r--r--   1 root root 1522929 Dec  5 08:52 rewrite.log.1
-rw-r--r--   1 root root   28671 Dec  5 08:52 ssl_access_log.1
-rw-r--r--   1 root root     250 Dec  5 08:49 ssl_error_log.1
-rw-r--r--   1 root root   35003 Dec  5 08:52 ssl_request_log.1
 
  


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
How to log internal-sftp chroot jailed users access log to /var/log/sftp.log file LittleMaster Linux - Server 0 09-04-2018 03:45 PM
issue with log rotate!!! Rotated log file is being written continuously kchaitanya Linux - Newbie 2 01-21-2018 09:33 AM
Log rotate not rotate newFreeBSD Linux - Server 13 09-12-2013 08:59 PM
Log Rotate Configuration on Apache 2.2.15 raj.mahanty@ismt.co.in Linux - Networking 1 09-14-2010 05:10 PM
Rotate display -- Option "Rotate" "CCW" Brad.Scalio@noaa.gov Linux - General 0 01-27-2009 05:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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