Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Much needed: well-highlighted JSON log viewer

Using winston for node.js logging, I get json log files. A log file in this vein is simply a sequence of (newline delimited) json objects. This is great for log querying and treating logs as first-class data!

However, both Sublime and gedit (at least the versions of them I'm using on Ubuntu, sublime 2 and gedit 3.6.2), poorly highlight json - they use the same color for keys and values, making any log drilling quite painful and really impossible to go through in any remotely humane manner.

Existing chrome extensions for json highlighting aren't helpful here either - they can't handle a collection of json objects and thus fail displaying these log files unless I manually turn them into an array within a synthetic parent object first (thus turning them into a json object). This is tedious in the case of viewing a log file that is still being written to and in general......

Is there any tool that can both swallow json log files as is, and at the same time highlight keys in a different color than values, so that json logs are also friendly to man, not only to machine?? this is a real pain.

Thanks!

like image 343
matanster Avatar asked Jan 18 '14 14:01

matanster


People also ask

What is JSON viewer?

JSON Viewer is an online web-based tool which helps to view, analyze JSON data simply along with formatting. Just upload JSON file/paste JSON code & view it.

Is JSON good for logging?

The biggest benefit of logging in JSON is that it's a structured data format. This makes it possible for you to analyze your logs like big data. It's not just readable text, but a database that can be queried.


1 Answers

Check out the Neon Color Scheme, available via Package Control and Github for Sublime Text. Keys and values are highlighted in different colors, and there are different key colors for different levels.

JSON with Neon

Full disclosure: I'm the maintainer for this project, but I really think it'll help you out - it certainly helps me when working with multi-leveled JSON files like the one shown above.

like image 86
MattDMo Avatar answered Sep 22 '22 02:09

MattDMo