dozzle
dozzle copied to clipboard
Support for JSON logs
This pull request adds JSON support.
- [x] Show all fields when no fields are selected
- [x] Allow adding and removing json fields
- [x] Save field list to localstorage
- [ ] Support search when JSON is enabled
- [ ] Highlight text when searching
- [ ] Filter with json keys
JSON.parse()
is very memory hungry for polymorphic objects.
If there are a lot of them, there may be memory leaks.
Tell me, please, will these JSON-events have a standard structure or a non-permanent one?
JSON.parse() is very memory hungry for polymorphic objects. If there are a lot of them, there may be memory leaks.
I read a lot about JSON.parse()
. Seems like for large json objects, it does eat a lot of memory. For smaller objects, it is much more efficient. I haven't found any proof of it. But I have only tested locally.
Tell me, please, will these JSON-events have a standard structure or a non-permanent one?
Unfortunately, there isn't a standard structure. Why would there be? The JSON objects are generated by the logging system for each container. They can be anything. At first I tried to use protobuf or other formats that would make the parsing more efficient. But after some research, for schemaless data, I found it didn't matter.
I would love to get more feedback on this feature. JSON logs are very powerful and Dozzle only treats it as text. I was thinking of even parsing all the json, pushing it to some client side database for better experience.
Firstly, you make a cool tool! I like it! Thank you!
Secondly, what kind of user experience will parsing these logs bring? As an example, key search? Or highlight? Or just pretty screen output?
about the JSON.parse(): I also have experience using it with a large flow of messages, it is very slow...
Right now this PR brings the ability to show only specific JSON fields. See screenshot which is work in progress.

Search by key would be a natural follow up. I think that's technically harder.
Just ideas, something might work:
- Enable compression (gzip) for SSE and return already parsed and pretty formatted JSON
- Show as usual text as default view, but when user click on logline - reformat code using JSON.parse()
Or did I misunderstand you at all?
Enable compression (gzip) for SSE and return already parsed and pretty formatted JSON
Does the pretty format make a difference?
Show as usual text as default view, but when user click on logline - reformat code using JSON.parse()
I was trying to be smarter and only render the JSON when the log is in with view. It turned out to be hard and I labeled it as premature optimization. :) I am going to look to see how this performs and come back on doing anything to improve speed.
Awesome! Sounds good.
Also, this feature can be enabled from startup configuration by the way :)
Do parse JSON
OR Do not parse JSON
Fixed some bugs and scrollback works now.