Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support consistent logs format #2323

Open
tormodmacleod opened this issue Jan 2, 2025 · 1 comment
Open

Support consistent logs format #2323

tormodmacleod opened this issue Jan 2, 2025 · 1 comment
Labels
Milestone

Comments

@tormodmacleod
Copy link

Summary

currently logs produced by shlink are in json format

{"level":"debug","ts":1735825779291448689,"logger":"rpc","msg":"plugin was started","address":"tcp://127.0.0.1:6001","list of the plugins with RPC methods:":["lock","informer","app","jobs","resetter"]}
{"level":"debug","ts":1735825779292705823,"logger":"memory","msg":"pipeline was started","driver":"memory","pipeline":"shlink","start":"2025-01-02 13:49:39.292702233 +0000 UTC","elapsed":"9.538µs"}

however, logs produced by road runner are not

2025-01-02T15:05:42+0000        INFO    server          [2025-01-02T15:05:42.301007+00:00] [95b60df1-7d85-4a59-8903-c0a7cc2ee4bb] Access.INFO - POST /rest/v3/short-urls 200 392
2025-01-02T15:05:44+0000        INFO    server          [2025-01-02T15:05:44.093284+00:00] [096a379e-3372-4449-a5ed-38466ea32b64] Access.INFO - POST /rest/v3/short-urls 200 392

update road runner config to also log in json format

Use case

we forward our logs to newrelic. like many other log destinations, logs received in json format are automatically parsed whereas logs received in text format are not. it is possible to configure custom parsers but this can be very fiddly

also, it seems like a good thing to have all logs in the same format 🙂

@acelaya
Copy link
Member

acelaya commented Jan 2, 2025

This is actually trickier. The logs above are in fact generated by RoadRunner, but they are JSON-formatted, even though the docs state they should be in a different format by default.

However, I know it produces other logs which are not JSON, probably due to some inconsistency between its logs channels.

On top of that, the logs below (access logs) are in fact generated by Shlink 😅.

Additionally, changing the logs format is a breaking change, so it needs to be configurable.

But that said, I do agree it makes sense for Shlink (and the tools used by it) to produce logs in consistent formats.

@acelaya acelaya changed the title structured logging in road runner Support consistent logs format Jan 2, 2025
@acelaya acelaya added this to the 4.5.0 milestone Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants