How do I use rotatelogs with CustomLog?

How do I use rotatelogs with CustomLog?

Post by Joe DeBattist » Thu, 07 Jan 1999 04:00:00



    Hi,
         I'm running Apache 1.3.3 on an RS/6000 under AIX 4.1.  I have a
little problem with the rotatelogs command.  In httpd.conf, I've got the
following entries for LogFormat and CustomLog.
This gives me an access_log with everything combined in to one log.

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# CustomLog /usr/local/apache/var/log/access_log common
#CustomLog /usr/local/apache/var/log/referer_log referer
#CustomLog /usr/local/apache/var/log/agent_log agent

CustomLog /usr/local/apache/var/log/access_log combined

What I'm now trying to do is get the rotatelogs to take the access_log
and rotate the logs every 24 hours.  I'm using the TransferLog with an
entry in httpd.conf that says:
TransferLog "|/local/apache/sbin/rotatelogs
/local/apache/var/log/access_log 86400

My problem is that the acess_log.xxxxxxxx is in the common format,
rather than the combined.  Can someone tell me how to have TransferLog
use the appropriate format?  Your help will be greatly appreciated.

Joe DeBattista


 
 
 

How do I use rotatelogs with CustomLog?

Post by Marc Slemk » Fri, 08 Jan 1999 04:00:00



Quote:>    Hi,
>         I'm running Apache 1.3.3 on an RS/6000 under AIX 4.1.  I have a
>little problem with the rotatelogs command.  In httpd.conf, I've got the
>following entries for LogFormat and CustomLog.
>This gives me an access_log with everything combined in to one log.
>LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
>combined
>LogFormat "%h %l %u %t \"%r\" %>s %b" common
>LogFormat "%{Referer}i -> %U" referer
>LogFormat "%{User-agent}i" agent
># CustomLog /usr/local/apache/var/log/access_log common
>#CustomLog /usr/local/apache/var/log/referer_log referer
>#CustomLog /usr/local/apache/var/log/agent_log agent
>CustomLog /usr/local/apache/var/log/access_log combined
>What I'm now trying to do is get the rotatelogs to take the access_log
>and rotate the logs every 24 hours.  I'm using the TransferLog with an
>entry in httpd.conf that says:
>TransferLog "|/local/apache/sbin/rotatelogs
>/local/apache/var/log/access_log 86400

TransferLog is just a shortcut for a specific instance of CustomLog
with a CLF format.  TransferLog always uses CLF.  If you want to
use a CustomLog directive, then do it and include the rotatelogs
stuff there.

 
 
 

1. rotatelog command and CustomLog / TransferLog

I am trying to understand how to use the Apache rotatelog command, and
reading any documentation or newsgroup postings has not completely
answered my questions, so here goes...

Server 1:
Apache running on Sun Solaris server, v2.8
Current httpd.conf information:

LogFormat "%h %l %u %t \"%r\" %>s %b" common
#
# The location and format of the access logfile (Common Logfile Format).

# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here.  Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
CustomLog /www/a/apache/logs/access_log common

##
## SSL Virtual Host Context
##

<VirtualHost _default_:8443>

#  General setup for the virtual host
DocumentRoot "/www/a/apache/htdocs"
#ServerName abc.xyz.com

ErrorLog /www/a/apache/logs/error_log
TransferLog /www/a/apache/logs/access_log

... So, if I understand this correctly, in this case since there is a
Virtual Host defined, the CustomLog directive is basically ignored and
all logging is put into the file defined by TransferLog (which, in this
case, is the same file ...).  I should be able to modify the TransferLog
statement to read:
TransferLog "|/www/a/apache/bin/rotatelogs
/www/a/apache/logs/access_log 604800"
and the result will be daily access_logs ....

Comments? Am I understanding the information they have in the file?

Server 2:
Apache running on Sun Solaris server, v2.8
Current httpd.conf information:

# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b" common

#
#SetEnvIf directive included to stop pings from being logged - 011303
SetEnvIf Request_URI "HEAD / HTTP/1.0" nolog

#
# The location and format of the access logfile (Common Logfile Format).

# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here.  Contrariwise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
# CustomLog logs/access_log common 011303: Replaced with nolog line
CustomLog logs/access_log common env=!nolog

... there is NO Virtual Host or TransferLog defined .....

In this case, how would I use the rotatelogs utility?

I do not think CustomLog "|/www/Artesia/apache/bin/rotatelogs
/www/Artesia/apache/logs/access_logs 604800" env=!nolog  will
work......

Suggestions / comments?

Thanks,
Jon

2. Need Help in Patching Linux Server RH 7.2

3. rotatelogs and the CustomLog directive

4. REPORT: NFS and ReiserFS very high latencies, with low-latency and preempt applied

5. Using cronolog instead of rotatelogs

6. Cute kernel trick, or communistic ploy?

7. HELP: Connectivity between DOS/DOS and DOS/Linux

8. Help

9. Apache1.3.0 - CustomLog Directive

10. CustomLog question

11. Customlog directive Apache1.2.4

12. CustomLog LogFormat etc.

13. only 404 errors in CustomLog