10 ms·
If you're tailing logs, can I suggest that you try out the Logfile Navigator (https://lnav.org https://lnav.org). It really is possible to do better than tail/
by tstack 5y ago
If you're tailing logs, can I suggest that you try out the Logfile Navigator (https://lnav.org https://lnav.org). It really is possible to do better than tail/less/whatever when you just want to look at a local log file:
https://lnav.org/2013/09/10/competing-with-tail.html https://lnav.org/2013/09/10/competing-with-tail.html
- austinjp 5y agoI've never heard of this. Looks great, thanks!
- totetsu 5y agoWas going to mention lnav also. You don't even need to install or compile it. Great for that server managed by a contractor.
- lathiat 5y agoThis looks really awesome, thanks! I think inline pretty-print of JSON/XML/YAML in a log entry.. plus histogram of date/time.. I do these things a lot using various grep/sort/uniq etc pipelines Wow!
- carlsborg 5y agoSql queries on merged logs, histograms, json log formatting. Sweet.
- TeMPOraL 5y agoIf you want... a fraction of the features, but still a nice experience, and you want a viewer in your editor, and if your editor is Emacs, try Logview mode - https://github.com/doublep/logview https://github.com/doublep/logview. I mention it both because I find it very useful and because, seeing Logfile Navigator, I now see that it desperately needs to have more features :).
- jimpudar 5y agoHow does it handle merging log files that are in different time zones? I wrote a small script to merge log files from lots of different network appliances a long time ago, it was extremely useful for debugging problems that occurred across our distributed system. The most unfortunate part was that the appliances all logged in local time and didn't include their UTC offsets in the timestamps :(
- tstack 5y agoTimezones are not automatically handled by lnav at the moment, which isn't great. Timestamps are parsed and treated as UTC internally, which usually works out fine. You can manually adjust all of the timestamps for a file using the ":adjust-log-time" command: https://docs.lnav.org/en/latest/commands.html#adjust-log-time-timestamp https://docs.lnav.org/en/latest/commands.html#adjust-log-tim... That can be useful for doing minor alignments if clocks are slightly out of sync or doing timezone adjustments. You can also adjust the time programmatically by updating the "time_offset" column in the "lnav_file" table: https://docs.lnav.org/en/latest/sqltab.html#lnav-file https://docs.lnav.org/en/latest/sqltab.html#lnav-file Sorry I don't have any examples written up to illustrate this at the moment...
- jimpudar 5y agoThanks, I see. At least with `:adjust-log-time` you can make it work! With my old log merging program, you had to supply a regex with groups for the different timezone components and optionally a UTC offset. That worked really well but was a pain to set up. Typically I was using it to look at the same format of files all the time though, so in practice it wasn't that bad. I'm not really a C/C++ person but maybe I'll try and hack on lnav a bit and see if I can figure out how to add timezone support.
- desktopninja 5y agoNice. This: https://lnav.org/features#query-logs-using-sql https://lnav.org/features#query-logs-using-sql Reminded me of: logParser https://www.microsoft.com/en-us/download/details.aspx?id=24659 https://www.microsoft.com/en-us/download/details.aspx?id=246...
- tstack 5y agoYes, Log Parser was the inspiration for that feature in lnav. That's why the column names are basically same between the two (e.g. c_ip, cs_uri_stem).