Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log files in json format #133

Open
maku opened this issue Apr 2, 2024 · 3 comments
Open

log files in json format #133

maku opened this issue Apr 2, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@maku
Copy link

maku commented Apr 2, 2024

it would be great when tailspin is able to handle log files in json format

@bensadeh bensadeh added the enhancement New feature or request label Apr 8, 2024
@bensadeh
Copy link
Owner

bensadeh commented Apr 8, 2024

Thanks for opening this issue @maku ,

json handling is something I have been a bit cautious of getting into, since I've been wanting the scope of tailspin to be just highlighting of regular log files. To understand the use case better, what are you looking for tailspin to do with json files that other tools (like jq) don't provide today?

@maku
Copy link
Author

maku commented Apr 9, 2024

@bensadeh I have an application that generates log data in JSON format (rolling file where the current daily data is logged into a separate file which is then archived in a folder every day). I'm looking for a simple app that can handle this with some kind of aggregation and present the JSON data and possibly also handle a search.

The format of the entries in the log file is:

{"requestId":"e2770848-0859-4e8d-8348-8ca7717fc5d9","uuid":"14ad72e3-16de-4c0c-ad72-e316de5c0c14","timestamp":"2024-04-08 10:27:31,102","message":"xxxxx","level":"ERROR","thread":"tomcat-handler-384","exception":"xxxx"}

(it is not valid json because the records are not in an array)

@bensadeh
Copy link
Owner

Thanks for explaining your use case in more detail.

This use case actually plays well into tailspin's architecture, because it works on one line at a time. In other words, we can parse these lines as a valid json, however, the challenge (for me) is how to handle it in a maintainable way (and without going into formatting territory). After all, I want tailspin to remain a highlighter. Maybe a middle ground is still useful.

For example, I've been toying with the idea of "flattening" simple jsons without any nested objects like in the example you provided by converting them into key value pairs separated by equals signs. The result would be something like this:

image

This would make the json entries more readable, and you could still search for entries and do anything else less supports.

(Side note: if you need aggregation and more advanced features for your log files, you might find tools like lnav more helpful)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants