-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 28. Jan, Peter Humphrey spammed my inbox with 
> On Sunday 27 January 2008 21:54:23 Mick wrote:
> > Hi All,
> >
> > I am sure that someone has asked this before, but a cursory look doesn't
> > bring anything up.  I am going through some logs and I cannot understand
> > what the time was when certain events took place:
> >
> > [1200806556] SERVICE ALERT: router.xxxxxxxxxxxxxxxxxxxxxxx
> > [1200806576] SERVICE ALERT: router.xxxxxxxxxxxxxxxxxxxxxxx
> > [1200806891] HOST ALERT: router.xxxxxxxxxxxxxxxxxxxxxxxxxx
> > [1200806891]
> >
> > Could you please tell me how to interpret/parse these so that they show
> > time in hrs:min so that I can understand it?  (anything I could feed to
> > less would be grand).
use perl or die()^^. I got it using the following jumbled one-liner:

perl -npe '/^\[(\d+)\]/; @times = localtime $1; $times[4]++; $times[5]+=1900;
s/\[\d+\]/$times[2]:$times[1] $times[3].$times[4].$times[5]/;'

Just pipe your log through that and you will get beautiful (european) dates 
instead of timestamps.

Regards
Jan Seeger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFHngYwMmLQdC6jvocRAofjAKCNWtVhKGrGgukMX9LprFDt08qblgCglj40
L3DUKgZpph5DnAB6qE36tIk=
=nyK3
-----END PGP SIGNATURE-----
-- 
gentoo-user@lists.gentoo.org mailing list

Reply via email to