Qmail
[Top] [All Lists]

Re: tai64n date format

To: qmail@list.cr.yp.to
Subject: Re: tai64n date format
From: Sami Farin <safari-qmail@safari.iki.fi>
Date: Mon, 2 Apr 2007 00:51:06 +0300
Delivered-to: sp-com-lists@consult.net
Delivered-to: gmail-qmail@securepoint.com
Delivered-to: sp.com.list@gmail.com
Delivered-to: mailing list qmail@list.cr.yp.to
In-reply-to: <a3bd4fe00704011420l1edac314q10c5b1d703713505@mail.gmail.com>
Mail-followup-to: qmail@list.cr.yp.to
Mailing-list: contact qmail-help@list.cr.yp.to; run by ezmlm
References: <a3bd4fe00704011052n1132c340k1320805947292f73@mail.gmail.com> <20070401181250.GA11214@odin.dempsky.org> <a3bd4fe00704011137s6186d8c6v60f5c4d200fb47ad@mail.gmail.com> <20070401185119.gvx5onvbvokzrjsm@m.safari.iki.fi> <a3bd4fe00704011420l1edac314q10c5b1d703713505@mail.gmail.com>
User-agent: Mutt/1.5.14 (2007-02-12)
On Sun, Apr 01, 2007 at 17:20:04 -0400, Vahid Moghaddasi wrote:
> On 4/1/07, Sami Farin <safari-qmail@safari.iki.fi> wrote:
> >
> >$ printf "@%x00000000\n" $(( $(date -d "2007-04-01 20:40:46.790878500" 
> >"+%s") + 4611686018427387914 ))
> >@40000000460feea800000000
> >$ echo @40000000460feea800000000 | tai64nlocal
> >2007-04-01 20:40:46.000000000
> >
> I think that I can use this to find the date entry in the log file
> with some changes. What I really want to do is similar to this: "cat
> current | grep <today's TAI date> > file.out. Then I would have all

Why don't you just do "svc -h /whatever/daemon/log" at 00:00 and
process the latest @* files?
By looking at the filename, you can figure out when
it was created.  If you used too small sNNN option,
current might contain only part of latest 24h logs.
After HUP multilog start writing to a new current (in case latest
current was > 0 bytes).

> the lines for today's date in the file.out file.
> I need to do this so I can run different reports on mail delivery.

Obviously those commands I posted are not optimized for speed.
Why don't you just feed log files to tai64nlocal and
grep for the date?  Or does the program which reads
file.out expect tai64 ?  In any case, it's easy to write a program
which takes as parameter date (e.g. 20070401) and reads
tai64 log lines from stdin and only spits out lines which
match date 20070401 ...

-- 

Attachment: pgpAlgGgbHaBS.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>