Changes between Version 9 and Version 10 of naemonlog


Ignore:
Timestamp:
06/07/22 00:41:05 (2 years ago)
Author:
krit
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • naemonlog

    v9 v10  
    8989[krit@mini log-viewer-1.0.1]$ ./logviewer.sh
    9090}}}
     91
     92== convert epoch time to human on Log file ==
     93
     94ref [https://unix.stackexchange.com/questions/623046/convert-replace-time-from-epoch-milliseconds-to-human-readable-date-in-logfiles here]
     95
     96Example: file.log
     97{{{
     981522693524403 entity1,sometext
     991522693541466 entity2,sometext
     1001522693547273 entity1,sometext
     101}}}
     102
     103Just use
     104
     105{{{
     106$ awk '{$1 = strftime("%F %T", substr($1,1,10))} 1' file.log
     1072018-04-02 21:25:24 entity1,sometext
     1082018-04-02 21:25:41 entity2,sometext
     1092018-04-02 21:25:47 entity1,sometext
     110}}}
     111
     112With milliseconds
     113
     114{{{
     115$ awk '{$1 = strftime("%F %T", substr($1,1,10)) "." substr($1,11)} 1' file.log
     1162018-04-02 21:25:24.403 entity1,sometext
     1172018-04-02 21:25:41.466 entity2,sometext
     1182018-04-02 21:25:47.273 entity1,sometext
     119}}}