1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
On Mon, 28. Jan, Peter Humphrey spammed my inbox with |
5 |
> On Sunday 27 January 2008 21:54:23 Mick wrote: |
6 |
> > Hi All, |
7 |
> > |
8 |
> > I am sure that someone has asked this before, but a cursory look doesn't |
9 |
> > bring anything up. I am going through some logs and I cannot understand |
10 |
> > what the time was when certain events took place: |
11 |
> > |
12 |
> > [1200806556] SERVICE ALERT: router.xxxxxxxxxxxxxxxxxxxxxxx |
13 |
> > [1200806576] SERVICE ALERT: router.xxxxxxxxxxxxxxxxxxxxxxx |
14 |
> > [1200806891] HOST ALERT: router.xxxxxxxxxxxxxxxxxxxxxxxxxx |
15 |
> > [1200806891] |
16 |
> > |
17 |
> > Could you please tell me how to interpret/parse these so that they show |
18 |
> > time in hrs:min so that I can understand it? (anything I could feed to |
19 |
> > less would be grand). |
20 |
use perl or die()^^. I got it using the following jumbled one-liner: |
21 |
|
22 |
perl -npe '/^\[(\d+)\]/; @times = localtime $1; $times[4]++; $times[5]+=1900; |
23 |
s/\[\d+\]/$times[2]:$times[1] $times[3].$times[4].$times[5]/;' |
24 |
|
25 |
Just pipe your log through that and you will get beautiful (european) dates instead of timestamps. |
26 |
|
27 |
Regards |
28 |
Jan Seeger |
29 |
-----BEGIN PGP SIGNATURE----- |
30 |
Version: GnuPG v2.0.7 (GNU/Linux) |
31 |
|
32 |
iD8DBQFHngYwMmLQdC6jvocRAofjAKCNWtVhKGrGgukMX9LprFDt08qblgCglj40 |
33 |
L3DUKgZpph5DnAB6qE36tIk= |
34 |
=nyK3 |
35 |
-----END PGP SIGNATURE----- |
36 |
-- |
37 |
gentoo-user@l.g.o mailing list |