RE: Apache log rotation question...

2006-11-08 Thread Brown, Steve
I am using cronolog to handle the logging end of apache.  Cronolog basically 
takes care of the logging for apache, allowing you much more flexibility with 
the logging options.  

Assuming..
1. You have cronolog installed
2. /path/to/your/logs/vhost1/ is a valid path

A sample Apache config line would read (main or virtual host context):

   ErrorLog "|cronolog /path/to/your/logs/vhost1/%Y%m%d_error.log"
   CustomLog "|cronolog /path/to/your/logs/vhost1/%Y%m%d_access.log" combined

I this example, you will generate logs with the names 20061108_error.log and 
20061108_access.log respectively and each day (midnight server time) cronolog 
will auto-gen new ones as soon as apache sends it something to log.  Using this 
method, cronolog is doing the logging for Apache specifically the way when 
where and how you want it negating the need for further scripting and 
manipulating of the logs afterward.

Hope that helps.
Steve

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Philip
Hallstrom
Sent: Friday, November 03, 2006 3:21 PM
To: Curtis Jewell
Cc: [EMAIL PROTECTED]
Subject: Re: Apache log rotation question...


> I'm wondering if I can safely use newsyslog with a newsyslog.conf with these 
> lines in it:

I don't know the answer to your question, but you might look at 
cronolog...

http://www.freebsd.org/cgi/url.cgi?ports/sysutils/cronolog/pkg-descr



>
> /var/log/httpd/access_log/*644  1 *$W0D0 G
> /var/log/httpd/error_log/* 644  1 *$W0D0 G
> /var/log/httpd/ssl_request.log 644  1 *$W0D0
> /var/log/httpd/error.log   644  1 *$W0D0
> # After this point should be one line...
> /var/log/httpd/access.log  644  1 *$W0D0 - 
> /var/run/httpd.pid 30
>
> or if not, what should I do instead?
>
> (I have 4 separate vhosts that keep their access logs in the first 2 
> directories)
>
> For the record, I want weekly rotation on Sundays at midnight (I assume JST, 
> since I have my time set to local time, which is JST [GMT+9, no DST]), 
> keeping 1 log, (the way I read the fine manuals, I'll have to have a cron job 
> bzip2 it up later and move it aside if I want to keep more and/or compress 
> them) permissions 644 with the owner being root:wheel, no size check, and the 
> last part of the last line should send a SIGUSR1 (30) signal to Apache, which 
> should do the equivalent of a 'apachectl -k graceful' per 
> http://httpd.apache.org/docs/2.2/stopping.html.
>
> My question really is, does newsyslog send the signal at the right time 
> [after the rotation is done, per 
> http://httpd.apache.org/docs/2.2/logs.html#rotation] and does it do the lines 
> in order???)
>
> - --Curtis
>
> - -- Curtis Jewell
> [EMAIL PROTECTED]
>
> "Killed enough? ... Yes, Your Highness, I think we all have."
>  --John Patrick Ryan (from 'The Sum Of All Fears', Tom Clancy)
>
> [I use Pine, which deliberately does not display colors and pictures
> in HTML mail]
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.5 (FreeBSD)
>
> iD8DBQFFS6ByvCi+150VKIMRAs6PAKDOOvnARxXKUTY5dvNrob3gl9+aZACdG+P+
> Uz0GrVe1p5MNuRPwiTbBXxY=
> =lTB2
> -END PGP SIGNATURE-
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
>
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Apache log rotation question...

2006-11-03 Thread Garance A Drosehn

At 5:02 AM +0900 11/4/06, Curtis Jewell wrote:


My question really is, does newsyslog send the signal at the right
time [after the rotation is done, per
  http://httpd.apache.org/docs/2.2/logs.html#rotation ]
and does it do the lines in order???)


You can see what it will do by running newsyslog with the options
of `-nv' to see what it would do, without it doing anything.
Eg:
 newsyslog -nvvf /tmp/newsyslog.conf

In your case you'd first want to use a different time in the entries
you've added, just so the time to rotate is "this hour" (ie, whatever
hour it is that you're running the program...).  So, do that, and
then run:
 newsyslog -nvf /tmp/newsyslog.conf

You'll see that it first rotates all files that should be rotated
for this run, then sends all signals it is supposed to send, then
waits 10 seconds or so, and finally it compresses any of the
old-files that it should compress.

If you have a set of files which are all written to by a single
process, then you should add the '/var/run/httpd.pid' to the
newsyslog entry for *every* file that process writes to.  The
way newsyslog handles things, it will only send a single signal
to any given process id, even if several different files from
that process were rotated.  Since all files have been rotated
before the process is signalled, the process will only need to
be signalled one time.

Try the run with '-nv' to see exactly how it would work.

--
Garance Alistair Drosehn =   [EMAIL PROTECTED]
Senior Systems Programmer   or   [EMAIL PROTECTED]
Rensselaer Polytechnic Institute; Troy, NY;  USA
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Apache log rotation question...

2006-11-03 Thread Philip Hallstrom
I'm wondering if I can safely use newsyslog with a newsyslog.conf with these 
lines in it:


I don't know the answer to your question, but you might look at 
cronolog...


http://www.freebsd.org/cgi/url.cgi?ports/sysutils/cronolog/pkg-descr





/var/log/httpd/access_log/*644  1 *$W0D0 G
/var/log/httpd/error_log/* 644  1 *$W0D0 G
/var/log/httpd/ssl_request.log 644  1 *$W0D0
/var/log/httpd/error.log   644  1 *$W0D0
# After this point should be one line...
/var/log/httpd/access.log  644  1 *$W0D0 - 
/var/run/httpd.pid 30


or if not, what should I do instead?

(I have 4 separate vhosts that keep their access logs in the first 2 
directories)


For the record, I want weekly rotation on Sundays at midnight (I assume JST, 
since I have my time set to local time, which is JST [GMT+9, no DST]), 
keeping 1 log, (the way I read the fine manuals, I'll have to have a cron job 
bzip2 it up later and move it aside if I want to keep more and/or compress 
them) permissions 644 with the owner being root:wheel, no size check, and the 
last part of the last line should send a SIGUSR1 (30) signal to Apache, which 
should do the equivalent of a 'apachectl -k graceful' per 
http://httpd.apache.org/docs/2.2/stopping.html.


My question really is, does newsyslog send the signal at the right time 
[after the rotation is done, per 
http://httpd.apache.org/docs/2.2/logs.html#rotation] and does it do the lines 
in order???)


- --Curtis

- -- Curtis Jewell
[EMAIL PROTECTED]

"Killed enough? ... Yes, Your Highness, I think we all have."
 --John Patrick Ryan (from 'The Sum Of All Fears', Tom Clancy)

[I use Pine, which deliberately does not display colors and pictures
in HTML mail]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFS6ByvCi+150VKIMRAs6PAKDOOvnARxXKUTY5dvNrob3gl9+aZACdG+P+
Uz0GrVe1p5MNuRPwiTbBXxY=
=lTB2
-END PGP SIGNATURE-
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Apache log rotation question...

2006-11-03 Thread Curtis Jewell

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


I'm wondering if I can safely use newsyslog with a newsyslog.conf with 
these lines in it:


/var/log/httpd/access_log/*644  1 *$W0D0 G
/var/log/httpd/error_log/* 644  1 *$W0D0 G
/var/log/httpd/ssl_request.log 644  1 *$W0D0
/var/log/httpd/error.log   644  1 *$W0D0
# After this point should be one line...
/var/log/httpd/access.log  644  1 *$W0D0 - 
/var/run/httpd.pid 30

or if not, what should I do instead?

(I have 4 separate vhosts that keep their access logs in the first 2 
directories)


For the record, I want weekly rotation on Sundays at midnight (I assume 
JST, since I have my time set to local time, which is JST [GMT+9, no 
DST]), keeping 1 log, (the way I read the fine manuals, I'll have to have 
a cron job bzip2 it up later and move it aside if I want to keep more 
and/or compress them) permissions 644 with the owner being root:wheel, no 
size check, and the last part of the last line should send a SIGUSR1 (30) 
signal to Apache, which should do the equivalent of a 'apachectl -k 
graceful' per http://httpd.apache.org/docs/2.2/stopping.html.


My question really is, does newsyslog send the signal at the right time 
[after the rotation is done, per 
http://httpd.apache.org/docs/2.2/logs.html#rotation] and does it do the 
lines in order???)


- --Curtis

- -- 
Curtis Jewell

[EMAIL PROTECTED]

"Killed enough? ... Yes, Your Highness, I think we all have."
  --John Patrick Ryan (from 'The Sum Of All Fears', Tom Clancy)

[I use Pine, which deliberately does not display colors and pictures
in HTML mail]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFS6ByvCi+150VKIMRAs6PAKDOOvnARxXKUTY5dvNrob3gl9+aZACdG+P+
Uz0GrVe1p5MNuRPwiTbBXxY=
=lTB2
-END PGP SIGNATURE-
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"