Logs do not rotate


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Logs do not rotate
# 1  
Old 05-11-2016
Logs do not rotate

My problem: Both access and error logs do not rotate any more and get really large.

They are located here: /srv/www/+vHost name here+/logs/

Configuration seems to be here:
/etc/logrotate.conf => looks OK, including "size 10M" to avoid large files
(/etc/logrotate.d => is empty)

manually starting logrotate (logrotate -v /etc/logrotate.conf)
only results in adding the current date to the log file name,
but there is no new empty log file created.
Instead, new log entries are still added to the renamed log files.

I tried to replace "create" inside the conf file with "copytruncate".
This time, the log file name is not changed (no date added), but there is no copy made
of the file and it is not emptied.

I hope this is the right forum to post to; I haven't set up the server myself and dive into the topic for the first time. General manuals did not help so far, unfortunately...
I'm not afraid to do further researches myself, but have no idea where to look for...
Thanks for any hints! Smilie

P.S.: The web server is running on
Amazon Linux AMI 2014.09.2 x86_64 HVM EBS
(httpd-2.2.31-1.6.amzn1.x86_64)
# 2  
Old 05-11-2016
Logrotate

Can you post the sanitized configuration file?

It is difficult to guess by your statement of /etc/logrotate.conf seems OK.

---------- Post updated at 02:49 PM ---------- Previous update was at 02:46 PM ----------

Still logging to old files? You may need to reload the logger (syslog/httpd) service.
# 3  
Old 05-11-2016
Sure, thanks for having a look!
Code:
weekly

rotate 4

# create # removed 
copytruncate

dateext

include /etc/logrotate.d

size 20M

/var/log/wtmp {
    monthly
    create 0664 root utmp
        minsize 1M
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0600 root utmp
    rotate 1
}

# 4  
Old 05-11-2016
Hello,

This looks like the default configuration file.

Your web server probably has a location specified for the vhost log. Check if there is a httpd (or similar) file under logrotate.d. My guess is your logrotate might be setup to rotate logs under /var/log/httpd, but not under /srv.
This User Gave Thanks to nandanlbhat For This Post:
# 5  
Old 05-11-2016
Indeed, thanks a lot! I wasn't aware that this configuration could be located somewhere else. (SinceI have almost no idea of Linux in general.)
Code:
/var/log/httpd/*log /srv/www/*/logs/*log {
        daily
        rotate 7
    missingok
    notifempty
    sharedscripts
    delaycompress
    postrotate
        /sbin/service httpd reload > /dev/null 2>/dev/null || true
    endscript
}

I will try to make changes here and see what happens.
Thanks again!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies

2. Shell Programming and Scripting

Log rotate

Hi, I have below script in logrotate.d to rotate logs. logs are not rotating after the file grow to 1k, do you have any idea? Is it because of it just only 1K? Please let me know if the below syntax is in correct. # more trotate /sourcepath/*/servers/*/logs/*log... (2 Replies)
Discussion started by: lpprasad321
2 Replies

3. UNIX for Dummies Questions & Answers

Need script to rotate logs

I have few solaris-10 non global zones, where one application is writing some logs to /var/ovd/ConfigLogs. It keeps increasing all the time, as it is needed by application team as of now. I want a small script, which I can configure in cronjob, which should : - Run every Saturday 10 PM - Copy... (5 Replies)
Discussion started by: solaris_1977
5 Replies

4. HP-UX

How To Rotate A File in HP-UX?

I need to rotate a file in HP-UX of a application. I´ve tried to do a task in the cron with a script (with sed and ed commands) but it was a successfully option (the application continued writing the file :( ) LINEAS_OUT=$(wc -l < $RMISTDOUT) LINEAS_FIN=1,expr $LINEAS_OUT - 100p sed... (19 Replies)
Discussion started by: werkraft
19 Replies

5. UNIX for Dummies Questions & Answers

Rotate logs every 1 hour

Hello All, I am learning unix and basically I want to rotate one of my application logs every 1 hour. I need to rotate that file every one hour. I looked in the forums and googled.. but couldn;t get proper information. Requesting you all to kindly guide me. Our application is running on... (4 Replies)
Discussion started by: arunpvp
4 Replies

6. Programming

Rotate an array

i have an array a={1,2,3,4,5} the output should be a= {4,5,1,2,3} please help me writin this program in c. (10 Replies)
Discussion started by: pgmfourms
10 Replies

7. Shell Programming and Scripting

Grep yesterday logs from weblogic logs

Hi, I am trying to write a script which would go search and get the info from the logs based on yesterday timestamp and write yesterday logs in new file. The log file format is as follows: """"""""""""""""""""""""""... (3 Replies)
Discussion started by: harish.parker
3 Replies

8. UNIX for Advanced & Expert Users

log rotate

hi , what is the meaning of log rotate? how do i rotate /var/adm/wtmps log and gzip it? (6 Replies)
Discussion started by: cromohawk
6 Replies

9. Shell Programming and Scripting

Perl script to rotate logs

I have a shell script that will gzip/tar/archive application logs that are over 20 days old which works just fine, but I would like to convert to a Perl script. Problem is, I'm a beginner with Perl and all attempts so far have failed. Basicaly I have a log dir /app/logs that contains several... (18 Replies)
Discussion started by: theninja
18 Replies
Login or Register to Ask a Question