tilt
tilt copied to clipboard
ability to render a server's json logs as human readable in Tilt
Describe the Feature You Want
Some servers write their logs in json so that they're machine-readable. When viewing them in Tilt, it'd be nice to be able to massage the output a bit to make them more human-readable.
Current Behavior
Tilt just logs the raw output (json) logged by the server.
Why Do You Want This?
Formatted logs are easier to read than JSON logs.
Additional context
- GCP log explorer lets you pull fields out of JSON logs - https://cloud.google.com/logging/docs/view/logs-viewer-interface
fwiw, when people ask for this, I usually point them to the tilt logs
command
https://docs.tilt.dev/cli/tilt_logs.html
Then you can pipe it to your favorite log processor (like jq
or humanlog
)
I guess this bug is about adding easier ways to do this from the web UI?
Yeah, specifically we're interested in the logs being human readable in the web UI
+1, having this available in the web UI will be a really nice QoL improvement. When you're dealing with a bunch of microservices and wish to see the logs on each of them individually, clicking a single button on the UI is a lot faster than typing out tilt logs and the name of the pod you're interested in
Would choice of log formatting be part of the resource definition or would it be some additional configuration that each developer would make?
@dspasojevic Personally, I think it being part of the resource definition would be sufficient. I don't think anyone wants to read the JSON logs in the UI (anything you use the JSON representation for is more than likely happening outside the UI)
Wanted to add that this is a feature I could really use. Especially being able to formatted json logs through the UI. Only being able to view the raw output of the json logs is currently a bit of a pain point for our team.
Also wanted to add that a UI component for this would be the best, but even when using tilt logs
for a resource with multiple containers, piping logs to jq
is still non-trivial. Unless I'm missing an option somewhere to prevent adding container prefixes, log lines come out as [container_name] <json log>
which itself is not valid JSON.
The prefixes can be filter out with an extra pipe through awk
, but still, something user-friendly to remove these prefixes so piping JSON logs to jq
was easy would be amazing.