aptible / supercronic

Cron for containers
MIT License
1.84k stars 112 forks source link

Fix formatting of log messages #54

Closed sauln closed 4 years ago

sauln commented 4 years ago

Hi! Thanks for this package, it's been really easy to setup and get going.

I was hoping for a way of specifying the log format, but haven't found anything in the docs.

Without using the -split-logs option, my logs are coming through formatted like

time="2019-01-12T19:35:00+09:00" level=info msg="hello from Supercronic" channel=stdout iteration=0 job.command="echo \"hello from Supercronic\"" job.position=0 job.schedule="*/5 * * * * * *"

but this is a bit of a drag to visually parse.

How do I get the logs that look like

INFO[2017-07-10T19:40:50+02:00] hello from Supercronic                        channel=stdout iteration=0 job.command="echo "hello from Supercronic"" job.position=0 job.schedule="*/5 * * * * * *"

or just show the message?

Thank you!

DeadLemon commented 4 years ago

Currently facing same issue

krallin commented 4 years ago

This particular format is not possible:

INFO[2017-07-10T19:40:50+02:00] hello from Supercronic                        channel=stdout iteration=0 job.command="echo "hello from Supercronic"" job.position=0 job.schedule="*/5 * * * * * *"

This would mean Supercronic somehow understands your log format and can modify it to make sense, which it can't do for every single logging format (we can't just blindly append to your logs — that wouldn't work for e.g. structure JSON logs).

67 adds a -passthrough-logs flag you can use to let your command's logs flow right out without Supercronic capturing them. You'll be able to add this and get your logs out un-altered by Supercronic.