gvalkov / tailon-legacy

Webapp for looking at and searching through log files
http://tailon-legacy.rtfd.org/
Other
191 stars 44 forks source link

Feature Request: Syntax highlighting #14

Open jdrews opened 8 years ago

jdrews commented 8 years ago

Syntax highlighting would be a welcome feature add. Something that lets a user color logs based on search words or regex. I would expect this to be a parameter or configuration file.

For example highlight all lines that say ERROR with red, DEBUG with blue, INFO with green, etc.

gvalkov commented 8 years ago

That would be nice indeed (rtail seems to handle that nicely). One option I've been thinking about is to define the highlighting rules in terms of a highlight.js language definition. I'll look into it.

jdrews commented 8 years ago

I looked into building a highlight.js language file to colorize logs I often tail. It was actually more complicated than I thought, since highlight.js is geared towards programming language syntax highlighting.

Here's the current syntax highlighter I use in bash environments to make it easier to read logs. It uses sed with regular expressions to add ANSI color tags to lines based on log level keywords.

https://gist.github.com/jdrews/af970bb97e8d34978621

And a picture of the output you get from it: screenshot_102415_052147_pm

Ideally, whatever you go with I'd hope it would support some sort of regular expression schema to allow users to tie matches to colors.

To give an example: I'd want to color lines that contain "ERROR" red and lines that contain "WARN" yellow so it's easy to tell we have problems.

efernandez commented 8 years ago

Would it be possible to color using bash control sequences?

http://misc.flogisoft.com/bash/tip_colors_and_formatting

chines commented 7 years ago

Content/Syntax highliting would be a desired feature for me as well. +1 to this, thanks again for such an amazing tool.

vizcay commented 6 years ago

To have at least bash color sequences (that are common in log files) will be a great addon.. integrating something like https://github.com/theZiz/aha maybe? Unfortunately I'm not myself a python dev to submit a PR..