File: log_rewriter.awk

package info (click to toggle)
mtail 3.0.0~rc24.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 6,944 kB
  • sloc: yacc: 530; makefile: 181; sh: 141; lisp: 77; awk: 17
file content (18 lines) | stat: -rw-r--r-- 445 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
BEGIN{
        now = systime()
        format = "%Y/%m/%d %H:%M:%S"
                
}
{
        split($1, DATE, "/")
        split($2, TIME, ":")
        t = mktime(DATE[1] " " DATE[2] " " DATE[3] " " TIME[1] " " TIME[2] " " TIME[3])
        if (delta == "") {
                delta = now - t
        }
        out = strftime(format, t + delta)
        for (i = 3; i <= NF; i++) {
                out = out OFS $i
        }
        print out
}