Sponsored Content
Top Forums Web Development how to wait after apache log rotation Post 302409730 by TonyFullerMalv on Friday 2nd of April 2010 08:20:06 AM
Old 04-02-2010
The usual system to use for log file rotation on Linux is logrotate the man page even includes an example entry for dealing with apache log file rotation.

Logrotate for Solaris, ready compiled and packaged up is available from:
Sunfreeware - Free and Open Source Software (FOSS) for Sun Microsystem's Solaris

Perhaps logrotate would be worth a try?


Note that the logrotate example does a:
Code:
kill -HUP

of the apache PID, not a restart of apache, perhaps you could try that in your savelog configuration.


The other idea to try is to do a copy truncate, that is copy the current log file to httpd.log.0 (having rolled the previous log files to httpd.log.n+1 first) and then do :
Code:
cat /dev/null > httpd.log

So that the inode number used by apache for the log file does not need to change?

Last edited by TonyFullerMalv; 04-02-2010 at 09:26 AM.. Reason: Extra ideas
 

10 More Discussions You Might Find Interesting

1. HP-UX

Log rotation on HP-UX

Can anyone post a sample log rotate and archive configuration on HP-UX? I really don't know how to do that... :( (3 Replies)
Discussion started by: untamed
3 Replies

2. Shell Programming and Scripting

log rotation

Hello all. Due to some reason I can not use HUP to rotate needed log files. So I use the standard method: cp $file $file.1 cat /dev/null > $file But if Java application in this time writing the output to $file, in the beginning of it appears many "^@^@^@^@^@^@". How to avoid it? Or how... (6 Replies)
Discussion started by: mirusnet
6 Replies

3. Shell Programming and Scripting

Log rotation script

I have the below script to help with disk space cleanup that finds logs older than a specified number of days (say 10 days). I need it to grab "active" logs as well. Problem is an "active log" will not get archived unless I put in 0 days which I don't want to do, I need to leave the past 10 days,... (2 Replies)
Discussion started by: theninja
2 Replies

4. Shell Programming and Scripting

log rotation and autosys

Hi, I current have many apps servers running and need to create a script to rotate logs daily, and then create an autosys job to delete logs that are older than 30 days. I was thrown into this and have no idea what to do, please help me get started, thanks! -----Post Update----- and i will... (6 Replies)
Discussion started by: new2learn09
6 Replies

5. Web Development

Mod_Jk Log rotation

Hi , I have cronolog (http://cronolog.org/) setup to rotate both my error and access logs, but how can I use it to rotate my mod_jk.log file. I tried different things but cant get it to work. I want to end up where all three files will be rotated daily in YYYY/MM/DD folder format. thanks (0 Replies)
Discussion started by: new2learn09
0 Replies

6. Shell Programming and Scripting

Log file rotation

Hi I am trying to create a simple function that implements log rotation rotatelogs () { file_name=$1 archive_dir=$2 retention_period=$3 find $archive_dir -name $file_name -mtime +$retention_period -exec rm -f {} \; } Issue i am facing is the file_name would be something like my... (3 Replies)
Discussion started by: xiamin
3 Replies

7. Solaris

Log rotation, twice

hi folk, need advise regarding the log rotation, i have the logadm set at 30 2 * * * /usr/sbin/logadm so it supposed to rotate once per day, but now it rotated twice! but someone my log will rotate at 2:30 AM, but then another 2 hours later, it creates a new and rotate a new log again,... (2 Replies)
Discussion started by: dehetoxic
2 Replies

8. UNIX for Dummies Questions & Answers

Log Rotation

Hi Guys, Good morning, I just want to know and collect ideas on this one. Regarding rotation of logs as I've observed it's not consistently functioning. I have a server with 8 Partitions, each partition has a dedicated directory for the logs that is needed and I set it every 5mins (300secs) the... (1 Reply)
Discussion started by: rymnd_12345
1 Replies

9. Shell Programming and Scripting

tail and log rotation

Need some suggestion with an old problem form a thread here: https://www.unix.com/shell-programming-scripting/153204-multiple-not-statement-awk.html Since my log is large, I did get help to make a line that splits the log into two partstail -f syslog | awk '!/snmpd|ntpd|reject/{print | "tee... (1 Reply)
Discussion started by: Jotne
1 Replies

10. Solaris

Log rotation

Hi All! I seem to have a problem with log rotation, unless I am doing something wrong, I have type the following command for testing purposes to see if the -s option works but he did not: logadm -w /var/adm/messages -C 8 -c -s 512k -t '/var/adm/messages.$n' -z 1 the file is now at this... (7 Replies)
Discussion started by: fretagi
7 Replies
VLOGGER(1)						User Contributed Perl Documentation						VLOGGER(1)

NAME
vlogger - flexible log rotation and usage tracking in perl SYNOPSIS
vlogger [OPTIONS]... [LOGDIR] DESCRIPTION
Vlogger is designed to make webserver log rotation simple and easy to manage. It deals with VirtualHost logs automatically, so only one directive is required to manage all hosts on a webserver. Vlogger takes piped output from Apache or another webserver, splits off the first field, and writes the logs to logfiles in subdirectories. It uses a filehandle cache to avoid resource limitations. It will start a new logfile at the beginning of a new day, and optionally start new files when a certain filesize is reached. It can maintain a symlink to the most recent log for easy access. Optionally, host parsing can be disabled for use in ErrorLog directives. To use vlogger, you need to add a "%v" to the first part of your LogFormat: LogFormat "%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined Then call it from a customlog: CustomLog "| /usr/sbin/vlogger -s access.log -u www-logs -g www-logs /var/log/apache" combined OPTIONS
Options are given in short format on the command line. -a Do not autoflush files. This may improve performance but may break logfile analyzers that depend on full entries in the logs. -e ErrorLog mode. In this mode, the host parsing is disabled, and the file is written out using the template under the specified LOGDIR. -n Disables rotation. This option disables rotation altogether. -f MAXFILES Maximum number of filehandles to keep open. Defaults to 100. Setting this value too high may result in the system run- ning out of file descriptors. Setting it too low may affect performance. -u UID Change user to UID when running as root. -g GID Change group to GID when running as root. -t TEMPLATE Filename template using Date::Format codes. Default is "%m%d%Y-access.log", or "%m%d%Y-error.log". When using the -r option, the default becomes "%m%d%Y-%T-access.log" or "%m%d%Y-%T-error.log". -s SYMLINK Specifies the name of a symlink to the current file. -r SIZE Rotate files when they reach SIZE. SIZE is given in bytes. -d CONFIG Use the DBI usage tracker. -h Displays help. -v Prints version information. DBI USAGE TRACKER
Vlogger can automatically keep track of per-virtualhost usage statistics in a database. DBI and the relevant drivers (eg. DBD::mysql) needs to be installed for this to work. Create a table in your database to hold the data. A "mysql_create.sql" script is provided for using this feature with MySQL. Configure the dsn, user, pass and dump values in the vlogger-dbi.conf file. The "dump" parameter controls how often vlogger will dump its stats into the database (the default is 30 seconds). Copy this file to somewhere convienient on your filesystem (like /etc/apache/vlogger-dbi.conf) and start vlogger with "-d /etc/apache/vlogger-dbi.conf". You might want to use this feature to easily bill customers on a daily/weekly/monthly basis for bandwidth usage. SEE ALSO
cronolog(1), httplog(1) BUGS None, yet. AUTHORS Steve J. Kondik <;shade@chemlab.org> WWW: http://n0rp.chemlab.org/vlogger perl v5.8.6 2005-03-18 VLOGGER(1)
All times are GMT -4. The time now is 10:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy