On Tue, Dec 29, 2009 at 04:05:46PM +0100, Martin Langhoff wrote:
> For people still looking at issues lurking in the
> NM/wpa_supplicant/driver interactions, I have written this simple
> script that helps correlate the wpa_supplicant logs (in
> seconds-since-boot) with the NM logs (timestamped by syslog).
> 
>   ? log-secs-to-utc.py < log-in-secs.log > log-in-utc.log

Are you sure about that code?  It doesn't use boottime.
Here's one derived from yours for processing dmesg.

Another fun one is to merge logs from various sources in time order ...
but you must watch for reordering within the second.

-- 
James Cameron
http://quozl.linux.org.au/
#!/usr/bin/python

import time, sys, re

uptime = float(open("/proc/uptime", 'r').read().strip().split(' ', 1)[0])
boottime = time.time() - uptime

# python cannot do while line = ... 
while 1:
    line = sys.stdin.readline()
    if not line:
        break
    m = re.match('\[([ \d.]+)\] (.+)', line)
    if m:
        ds = float(m.group(1)) + boottime
        ds = time.asctime(time.gmtime(ds))
        line = ds + ' ' + m.group(2) + "\n"
        
    # always write
    sys.stdout.write(line)
_______________________________________________
Devel mailing list
[email protected]
http://lists.laptop.org/listinfo/devel

Reply via email to