Sponsored Content
Full Discussion: logrotate httpd logfiles
Operating Systems Linux Red Hat logrotate httpd logfiles Post 302386018 by renuka on Monday 11th of January 2010 05:01:37 AM
Old 01-11-2010
logrotate httpd logfiles

Hi,
I need to logrotate logs in directories in /var/log/httpd/. There are 4 directories in /var/log/httpd/... these directories are /var/log/httpd/access/
/var/log/httpd/debug/
/var/log/httpd/error/
/var/log/httpd/required/
Each of the access, required, error and debug directories have around 20 to 30 access log files of different locations for example:mumbai-access.log, pune-access.log etc..same is the case for 'error' dir 'required' dir and 'debug' dir in /var/log/httpd/
I need to clean up the logfiles in all the 4 directories access, error, debug and required...
I have made a custom logrotate file as follows:
-------------------------------------------------------------------------
Code:
# vi /etc/logrotate.d/httpd-logs
/var/log/httpd/access/*.monitor.com-access_log 
{
weekly
missingok
nocreate
postrotate
find /var/log/httpd/access -name '*.monitor.com-access_log' -type f -mtime +7 -print | xargs /bin/rm -rf
endscript 
}
/var/log/httpd/error/*.monitor.com-error_log
{
weekly
missingok
nocreate
postrotate
find /var/log/httpd/error -name '*.monitor.com-error_log' -type f -mtime +7 -print | xargs /bin/rm -rf
endscript 
}
/var/log/httpd/request/*.monitor.com-ssl_request_log
{
weekly
missingok
nocreate
postrotate
find /var/log/httpd/request -name '*.monitor.com-ssl_request_log' -type f -mtime +7 -print | xargs /bin/rm -rf
endscript 
}
/var/log/httpd/debug/*.monitor.com-rw_log
{
weekly
notifempty
missingok
compress
}

---------------------------------------------------------------------------
Is the above config correct?
Am I missing something? Will this logrotate the files in /var/log/httpd/access, /var/log/httpd/error, /var/log/httpd/required and /var/log/httpd/error ?
do i need to include following line in postrotate " /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true" ?

Last edited by pludi; 01-11-2010 at 06:13 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Logfiles

My server has only has access logs turned on. How do I turn on the other standard logs (i.e. I'd like to see the referring urls). Thanks in advance. (3 Replies)
Discussion started by: pingdom
3 Replies

2. UNIX for Dummies Questions & Answers

Controlling logfiles

I support an app that outputs alert and audit messages to one log file (vendor says they can't be separated). The script that I have written takes a copy (mv cmd) of the file to do the separation and reformatting. I have a problem that I loose records (messages are being written constantly, upto 3+... (5 Replies)
Discussion started by: nhatch
5 Replies

3. Shell Programming and Scripting

Logfiles E-mailed

Hi All There are some cron jobs ,which runs 24 hrs. Log files are generated when one job fails. So I need the log files to be emailed to my personal e-mail id. So that I can see the log files at my home If there is any error. How can I implement this in Unix shell programming. Thanks... (4 Replies)
Discussion started by: deep_kol
4 Replies

4. Shell Programming and Scripting

split monthly logfiles into daily logfiles

Hi, I have a lot of logfiles like fooYYYYMM.log (foo200301.log, foo200810.log) with lines like YYYY-MM-DD TIMESTAMP,text1,text2,text3... but I need (for postprocessing) the form fooYYYYMMDD.log (so foo200402.log becomes foo20040201.log, foo20040202.log...) with unmodified content of lines. ... (1 Reply)
Discussion started by: clzupp
1 Replies

5. Shell Programming and Scripting

Logfiles

Hi All, I have a peculiar problem. I will call a script from another script. Script abc.ksh is called by ABC.ksh as ABC.ksh abc.ksh in abc.ksh I will create and redirect all the statements to log file. ABC.ksh will also has a log file. I want all the logs generated in file abc in ABC... (5 Replies)
Discussion started by: javeed7
5 Replies

6. UNIX for Advanced & Expert Users

logrotate with /etc/logrotate.conf file

Hi there, I want to rotate the logfiles which are located in /var/log/jboss/tomcat* so I have created a file named as 'tomat' in /etc/logrotate.d/tomcat with the following content. # cat /etc/logrotate.d/tomcat /var/log/jboss/tomcat_access_log*.log { daily nocreate ... (2 Replies)
Discussion started by: skmdu
2 Replies

7. UNIX for Dummies Questions & Answers

Gzip many logfiles in one time

Hi All, I am working on a script and i am now been stuck in the mid of it.. My Script actually list the files consuming large disk it need compress the log files.. Here are the files Hello_2009_10_22.log Hello_2009_10_23.log.gz Hello_2009_10_24.log.gz Hello_2009_10_22.log... (2 Replies)
Discussion started by: sumithra
2 Replies

8. Shell Programming and Scripting

Logrotate - I am not able to rotate files using logrotate

I have written script which is working in Home directory perfectly and also compressing log files and rotating correctly. But, when i try to run script for /var/log/ i am able to get compressed log files but not able to get rotation of compressed log files. Please suggest. I am using below command... (5 Replies)
Discussion started by: VSom007
5 Replies

9. AIX

Logrotate - /etc/logrotate.conf does't exist

Hi Admins. I have installed logrotate rpm on Aix 6.1. After the installation of rpm, I don't find /etc/logrotate.conf file and /etc/logrotate.d dir . The config file is located in /opt/freeware/etc/logrotate.conf. When I ran logrotate -v /opt/freeware/etc/logrotate.conf I get below... (2 Replies)
Discussion started by: snchaudhari2
2 Replies

10. Shell Programming and Scripting

Logrotate.d for every httpd instance for loop?

/etc/logrotate.d -rwxr-xr-x 1 root root 263 Aug 28 23:17 httpd-stooffsprod -rwxr-x--- 1 root root 273 Jul 10 2015 httpd-mwsi2hprodhist2 -rwxr-x--- 1 root root 261 Aug 11 17:28 httpd-mwsihist2 -rwxr-x--- 1 root root 269 Jul 20 2015 httpd-mwsiprodhist2 I need to figure out how to build a... (14 Replies)
Discussion started by: xgringo
14 Replies
APACHECTL(8)							     apachectl							      APACHECTL(8)

NAME
apachectl - Apache HTTP Server Control Interface SYNOPSIS
When acting in pass-through mode, apachectl can take all the arguments available for the httpd binary. apachectl [ httpd-argument ] When acting in SysV init mode, apachectl takes simple, one-word commands, defined below. apachectl command SUMMARY
apachectl is a front end to the Apache HyperText Transfer Protocol (HTTP) server. It is designed to help the administrator control the functioning of the Apache httpd daemon. The apachectl script can operate in two modes. First, it can act as a simple front-end to the httpd command that simply sets any necessary environment variables and then invokes httpd, passing through any command line arguments. Second, apachectl can act as a SysV init script, taking simple one-word arguments like start, restart, and stop, and translating them into appropriate signals to httpd. If your Apache installation uses non-standard paths, you will need to edit the apachectl script to set the appropriate paths to the httpd binary. You can also specify any necessary httpd command line arguments. See the comments in the script for details. The apachectl script returns a 0 exit value on success, and >0 if an error occurs. For more details, view the comments in the script. OPTIONS
Only the SysV init-style options are defined here. Other arguments are defined on the httpd manual page. start Start the Apache httpd daemon. Gives an error if it is already running. This is equivalent to apachectl -k start. stop Stops the Apache httpd daemon. This is equivalent to apachectl -k stop. restart Restarts the Apache httpd daemon. If the daemon is not running, it is started. This command automatically checks the configuration files as in configtest before initiating the restart to make sure the daemon doesn't die. This is equivalent to apachectl -k restart. fullstatus Displays a full status report from mod_status. For this to work, you need to have mod_status enabled on your server and a text-based browser such as lynx available on your system. The URL used to access the status report can be set by editing the STATUSURL variable in the script. status Displays a brief status report. Similar to the fullstatus option, except that the list of requests currently being served is omit- ted. graceful Gracefully restarts the Apache httpd daemon. If the daemon is not running, it is started. This differs from a normal restart in that currently open connections are not aborted. A side effect is that old log files will not be closed immediately. This means that if used in a log rotation script, a substantial delay may be necessary to ensure that the old log files are closed before processing them. This command automatically checks the configuration files as in configtest before initiating the restart to make sure Apache doesn't die. This is equivalent to apachectl -k graceful. graceful-stop Gracefully stops the Apache httpd daemon. This differs from a normal stop in that currently open connections are not aborted. A side effect is that old log files will not be closed immediately. This is equivalent to apachectl -k graceful-stop. configtest Run a configuration file syntax test. It parses the configuration files and either reports Syntax Ok or detailed information about the particular syntax error. This is equivalent to apachectl -t. The following option was available in earlier versions but has been removed. startssl To start httpd with SSL support, you should edit your configuration file to include the relevant directives and then use the normal apachectl start. Apache HTTP Server 2005-08-26 APACHECTL(8)
All times are GMT -4. The time now is 09:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy