segmentio / topicctl

Tool for declarative management of Kafka topics
MIT License
579 stars 54 forks source link

Optional flag to enable logging in json format #206

Open srini-hv opened 1 week ago

srini-hv commented 1 week ago

This change introduces a new global flag --json-output which when provided generates logs in JSON format. This is very helpful especially when the logs are parsed. Datadog in our case. By default, all the logs generated by Topicctl are currently flagged as errors(see attached). I'm sure there are more use cases that would get benefitted by logs in json format.

image

With Json logging enabled:

{"msg":"Partition placement already satisfies strategy 'any'","level":"info","time":"2024-06-26T12:42:46Z"}
{"msg":"Checking partition placement...","level":"info","time":"2024-06-26T12:42:46Z"}

image

srini-hv commented 1 week ago

@petedannemann @ssingudasu Can you please take a look?