Return-Path: X-Original-To: apmail-httpd-users-archive@www.apache.org Delivered-To: apmail-httpd-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 96E899A0B for ; Sat, 1 Oct 2011 15:09:04 +0000 (UTC) Received: (qmail 86371 invoked by uid 500); 1 Oct 2011 15:09:01 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 86315 invoked by uid 500); 1 Oct 2011 15:09:01 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 86306 invoked by uid 99); 1 Oct 2011 15:09:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Oct 2011 15:09:01 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of covener@gmail.com designates 209.85.210.173 as permitted sender) Received: from [209.85.210.173] (HELO mail-iy0-f173.google.com) (209.85.210.173) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Oct 2011 15:08:55 +0000 Received: by iagf6 with SMTP id f6so4458343iag.18 for ; Sat, 01 Oct 2011 08:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Z+lXOMaLxt2V+l+LO29RnqLqPvBai52YYCb9zuV3T3I=; b=j/enTn4/WSZh8xD4Stt3Y04fPnEXKi15T8kX7EbLzGqzGwG+a1XVDCrch2WMc92FKa CwkL6KTD+5PwP8GidWPxJMaR9QGQGaNSyvDfpR7FPBW9QsPIWIobrKpNhpSFb+hWN+Lj TCOIboisQk0GQtKT/Vc0BTTBrLBWAqf3GVU3Q= MIME-Version: 1.0 Received: by 10.42.132.196 with SMTP id e4mr4460844ict.195.1317481714013; Sat, 01 Oct 2011 08:08:34 -0700 (PDT) Received: by 10.43.47.4 with HTTP; Sat, 1 Oct 2011 08:08:33 -0700 (PDT) Received: by 10.43.47.4 with HTTP; Sat, 1 Oct 2011 08:08:33 -0700 (PDT) In-Reply-To: <4E8686EC.2090100@panix.com> References: <4E8686EC.2090100@panix.com> Date: Sat, 1 Oct 2011 11:08:33 -0400 Message-ID: From: Eric Covener To: users@httpd.apache.org Content-Type: multipart/alternative; boundary=90e6ba5bc79b8fd7a704ae3e1db2 X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [users@httpd] problem with rotatelogs time of day formatting --90e6ba5bc79b8fd7a704ae3e1db2 Content-Type: text/plain; charset=ISO-8859-1 When you rotate on time interval, rotatelogs names the file not after the time it logged the first msg but from a normalized start of an interval. 24 hour intervals start at midnight On Sep 30, 2011 11:20 PM, "Albert Lunde" wrote: > > I'm trying to set up piped access and error logs, with "rotatelogs", as I'm porting the configuration from Solaris box to a small cluster of Linux VMs running RHEL 5. > > We're trying to use file name patterns like: > > error_log_chnuinfow3.%Y-%m-%d-%H_%M_%S.txt > > The date substitutions are working, but the time of day characters come out as zeros. An example, and some system information, are quoted below. > > I originally was trying to use rotatelogs from the Red Hat httpd RPMs. > > But since they are a version of httpd 2.2.3 with back-ported patches, > I then tried building the newest httpd 2.2.21 from source, off to one side, with static support binaries. > > That's the source of /usr/local/sbin/rotatelogs below. But both versions seem to have the same symptom. > > I wrote a C program to test the system strftime, and that seemed to work as expected, but I suppose the APR library date/time library is what is being used, making that somewhat moot. > > (I'm also aware of logrotate, and the legacy server just stops and starts the server in a nightly job that also rotates the logs in a shell script. Others wanted to do use piped log rotation, > I'm trying to make it work.) > > Any ideas? > > ErrorLog "|/usr/local/sbin/rotatelogs -f /var/log/httpd/error_log_chnuinfow3.%Y-%m-%d-%H_%M_%S.txt 86400" > > [root@chnuinfow3 conf]# ls -1 /var/log/httpd > access_log_chnuinfow3.2011-09-30-00_00_00.txt > access_log_chnuinfow3.2011-10-01-00_00_00.txt > access_log_skipped_chnuinfow3.2011-09-30-00_00_00.txt > access_log_skipped_chnuinfow3.2011-10-01-00_00_00.txt > error_log_chnuinfow3.2011-09-30-00_00_00.txt > error_log_chnuinfow3.2011-10-01-00_00_00.txt > >> [lunde@chnuinfow3 ~]$ rpm -qa | grep httpd >> httpd-devel-2.2.3-45.el5 >> httpd-manual-2.2.3-45.el5 >> system-config-httpd-1.3.3.3-1.el5 >> httpd-2.2.3-45.el5 > > >> [lunde@chnuinfow3 ~]$ uname -a >> Linux chnuinfow3.it.northwestern.edu 2.6.18-238.9.1.el5 #1 SMP Fri Mar 18 12:42:39 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux > > >> [root@chnuinfow3 conf]# /usr/sbin/httpd -V >> Server version: Apache/2.2.3 >> Server built: Dec 7 2010 11:19:58 >> Server's Module Magic Number: 20051115:3 >> Server loaded: APR 1.2.7, APR-Util 1.2.7 >> Compiled using: APR 1.2.7, APR-Util 1.2.7 >> Architecture: 64-bit >> Server MPM: Prefork >> threaded: no >> forked: yes (variable process count) >> Server compiled with.... >> -D APACHE_MPM_DIR="server/mpm/prefork" >> -D APR_HAS_SENDFILE >> -D APR_HAS_MMAP >> -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) >> -D APR_USE_SYSVSEM_SERIALIZE >> -D APR_USE_PTHREAD_SERIALIZE >> -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT >> -D APR_HAS_OTHER_CHILD >> -D AP_HAVE_RELIABLE_PIPED_LOGS >> -D DYNAMIC_MODULE_LIMIT=128 >> -D HTTPD_ROOT="/etc/httpd" >> -D SUEXEC_BIN="/usr/sbin/suexec" >> -D DEFAULT_PIDLOG="run/httpd.pid" >> -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" >> -D DEFAULT_LOCKFILE="logs/accept.lock" >> -D DEFAULT_ERRORLOG="logs/error_log" >> -D AP_TYPES_CONFIG_FILE="conf/mime.types" >> -D SERVER_CONFIG_FILE="conf/httpd.conf" > > > Test of the system strftime on a similar pattern seems OK: > >> [lunde@chnuinfow3 ~]$ cat strftime_test.c >> #include >> #include >> #include >> #include >> >> /* gcc -ansi -Wall strftime_test.c -o strftime_test */ >> >> int main (int argc, char** argv) >> { >> >> time_t rawtime; >> struct tm * timeinfo; >> char buffer [80]; >> if(argc<2){ >> printf("# Usage: strftime_test \n"); >> exit(0); >> } >> >> time ( &rawtime ); >> timeinfo = localtime ( &rawtime ); >> >> strftime (buffer,80,argv[1],timeinfo); >> puts (buffer); >> >> return 0; >> } >> >> >> [lunde@chnuinfow3 ~]$ ./strftime_test "%Y-%m-%d-%H_%M_%S" >> 2011-09-30-22_02_12 >> [lunde@chnuinfow3 ~]$ > > > > > -- > Albert Lunde albert-lunde@northwestern.edu > atlunde@panix.com (address for personal mail) > > --------------------------------------------------------------------- > The official User-To-User support forum of the Apache HTTP Server Project. > See for more info. > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org > " from the digest: users-digest-unsubscribe@httpd.apache.org > For additional commands, e-mail: users-help@httpd.apache.org > --90e6ba5bc79b8fd7a704ae3e1db2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

When you rotate on time interval, rotatelogs names the file not after th= e time it logged the first msg but from a normalized start of an interval. = 24 hour intervals start at midnight

On Sep 30, 2011 11:20 PM, "Albert Lunde" <atlunde@panix.com> wrote:
>
> I'm trying to set up piped access and error logs, with "rotat= elogs", as I'm porting the configuration from Solaris box to a sma= ll cluster of Linux VMs running RHEL 5.
>
> We're trying to use file name patterns like:
>
> error_log_chnuinfow3.%Y-%m-%d-%H_%M_%S.txt
>
> The date substitutions are working, but the time of day characters com= e out as zeros. An example, and some system information, are quoted below.<= br> >
> I originally was trying to use rotatelogs from the Red Hat httpd RPMs.=
>
> But since they are a version of httpd 2.2.3 with back-ported patches,<= br> > I then tried building the newest httpd 2.2.21 from source, off to one = side, with static support binaries.
>
> That's the source of /usr/local/sbin/rotatelogs below. But both ve= rsions seem to have the same symptom.
>
> I wrote a C program to test the system strftime, and that seemed to wo= rk as expected, but I suppose the APR library date/time library is what is = being used, making that somewhat moot.
>
> (I'm also aware of logrotate, and the legacy server just stops and= starts the server in a nightly job that also rotates the logs in a shell s= cript. Others wanted to do use piped log rotation,
> I'm trying to make it work.)
>
> Any ideas?
>
> ErrorLog "|/usr/local/sbin/rotatelogs -f /var/log/httpd/error_log= _chnuinfow3.%Y-%m-%d-%H_%M_%S.txt 86400"
>
> [root@chnuinfow3 conf]# ls -1 /var/log/httpd
> access_log_chnuinfow3.2011-09-30-00_00_00.txt
> access_log_chnuinfow3.2011-10-01-00_00_00.txt
> access_log_skipped_chnuinfow3.2011-09-30-00_00_00.txt
> access_log_skipped_chnuinfow3.2011-10-01-00_00_00.txt
> error_log_chnuinfow3.2011-09-30-00_00_00.txt
> error_log_chnuinfow3.2011-10-01-00_00_00.txt
>
>> [lunde@chnuinfow3 ~]$ rpm -qa | grep httpd
>> httpd-devel-2.2.3-45.el5
>> httpd-manual-2.2.3-45.el5
>> system-config-httpd-1.3.3.3-1.el5
>> httpd-2.2.3-45.el5
>
>
>> [lunde@chnuinfow3 ~]$ uname -a
>> Linux chnuinfow3= .it.northwestern.edu 2.6.18-238.9.1.el5 #1 SMP Fri Mar 18 12:42:39 EDT = 2011 x86_64 x86_64 x86_64 GNU/Linux
>
>
>> [root@chnuinfow3 conf]# /usr/sbin/httpd -V
>> Server version: Apache/2.2.3
>> Server built: =A0 Dec =A07 2010 11:19:58
>> Server's Module Magic Number: 20051115:3
>> Server loaded: =A0APR 1.2.7, APR-Util 1.2.7
>> Compiled using: APR 1.2.7, APR-Util 1.2.7
>> Architecture: =A0 64-bit
>> Server MPM: =A0 =A0 Prefork
>> =A0threaded: =A0 =A0 no
>> =A0 =A0forked: =A0 =A0 yes (variable process count)
>> Server compiled with....
>> =A0-D APACHE_MPM_DIR=3D"server/mpm/prefork"
>> =A0-D APR_HAS_SENDFILE
>> =A0-D APR_HAS_MMAP
>> =A0-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
>> =A0-D APR_USE_SYSVSEM_SERIALIZE
>> =A0-D APR_USE_PTHREAD_SERIALIZE
>> =A0-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
>> =A0-D APR_HAS_OTHER_CHILD
>> =A0-D AP_HAVE_RELIABLE_PIPED_LOGS
>> =A0-D DYNAMIC_MODULE_LIMIT=3D128
>> =A0-D HTTPD_ROOT=3D"/etc/httpd"
>> =A0-D SUEXEC_BIN=3D"/usr/sbin/suexec"
>> =A0-D DEFAULT_PIDLOG=3D"run/httpd.pid"
>> =A0-D DEFAULT_SCOREBOARD=3D"logs/apache_runtime_status"<= br> >> =A0-D DEFAULT_LOCKFILE=3D"logs/accept.lock"
>> =A0-D DEFAULT_ERRORLOG=3D"logs/error_log"
>> =A0-D AP_TYPES_CONFIG_FILE=3D"conf/mime.types"
>> =A0-D SERVER_CONFIG_FILE=3D"conf/httpd.conf"
>
>
> Test of the system strftime on a similar pattern seems OK:
>
>> [lunde@chnuinfow3 ~]$ cat strftime_test.c
>> #include <stdio.h>
>> #include <time.h>
>> #include <stdlib.h>
>> #include <unistd.h>
>>
>> /* gcc -ansi -Wall strftime_test.c -o strftime_test */
>>
>> int main (int argc, char** argv)
>> {
>>
>> time_t rawtime;
>> struct tm * timeinfo;
>> char buffer [80];
>> if(argc<2){
>> =A0 =A0printf("# Usage: strftime_test <format-string>\n= ");
>> =A0 =A0exit(0);
>> }
>>
>> time ( &rawtime );
>> timeinfo =3D localtime ( &rawtime );
>>
>> strftime (buffer,80,argv[1],timeinfo);
>> puts (buffer);
>>
>> return 0;
>> }
>>
>>
>> [lunde@chnuinfow3 ~]$ ./strftime_test "%Y-%m-%d-%H_%M_%S"= ;
>> 2011-09-30-22_02_12
>> [lunde@chnuinfow3 ~]$
>
>
>
>
> --
> =A0 =A0Albert Lunde =A0albert-lunde@northwestern.edu
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0atlunde@panix.com =A0(address for personal mail)
>
> ---------------------------------------------------------------------<= br> > The official User-To-User support forum of the Apache HTTP Server Proj= ect.
> See <URL:http://= httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> =A0" =A0 from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>

--90e6ba5bc79b8fd7a704ae3e1db2--