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

How to parse a Json Log #42

Open
dtavolato opened this issue Nov 26, 2024 · 3 comments
Open

How to parse a Json Log #42

dtavolato opened this issue Nov 26, 2024 · 3 comments

Comments

@dtavolato
Copy link

Hello Guys and thank for the great job.
I would like to use LogJoint to parse and merge multiple log file, those log are im Json format.
Is it possible to parse like LogJoint already does with XML log?

@sergey-su
Copy link
Owner

Yes, it's possible to parse JSON logs. Your JSON format has to be described first, same as with XML logs. If you select Log Sources -> Add... -> Manage Formats..., you can open a wizard that can help describe the format. In the wizard, there is a help article.

If you have difficulties with the wizard, you can send a sample of your json log, and I can help create the format description.

@dtavolato
Copy link
Author

Hello! Thanks for your feedback. Here is a sample of my log format. It would be nice if you could help me with this.
Thanks!
logFile_INFO.20241120.1.json

@sergey-su
Copy link
Owner

Here you go.

Unzip the XML format description file into C:\Users\your_user\AppData\Local\LogJoint\bin\Formats or whatever your installation dir is. Then LogJoint should recognize the log format once you drag&drop a log.

You may want to edit the XML. I assumed that errors and warnings are encoded as "level": "ERROR" and "level": "WARN" respectively. I also assumed that encoding is utf-8 and the file extension is *.json.

Your sample log is not strictly ordered by time, so I added an option to dynamically reorder the logs with window size of 50 messages.

dtavolato - JSON log.format.zip

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

No branches or pull requests

2 participants