tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.55k stars 298 forks source link

ability to render a server's json logs as human readable in Tilt #4581

Open landism opened 3 years ago

landism commented 3 years ago

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

nicks commented 3 years ago

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?

jbadlato commented 2 years ago

Yeah, specifically we're interested in the logs being human readable in the web UI

huangzou70 commented 2 years ago

+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

dspasojevic commented 1 year ago

Would choice of log formatting be part of the resource definition or would it be some additional configuration that each developer would make?

jbadlato commented 1 year ago

@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)

eric-lammers-form3 commented 1 year ago

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.

joeellis commented 1 year ago

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.

mateodelnorte commented 2 months ago

Any intention by the team to implement this? Would be extremely helpful both in the cli and web interface.