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

Improve structured logging #8683

Open
matrixbot opened this issue Dec 18, 2023 · 0 comments
Open

Improve structured logging #8683

matrixbot opened this issue Dec 18, 2023 · 0 comments

Comments

@matrixbot
Copy link
Collaborator

matrixbot commented Dec 18, 2023

This issue has been migrated from #8683.


Building on #8588 there's a desire to improve the output of Synapse structured logging.

Currently a "standard" log line would be turned into JSON (this was a curl to /_matrix/client/r0/login to get the login flows, but other logs look similar):

2020-10-29 07:36:00,762 - synapse.access.http.8080 - 315 - INFO - GET-0 - - - 8080 - {None} Processed request: 0.000sec/-0.000sec (0.000sec, 0.000sec) (0.000sec/0.000sec/0) 285B 200 "GET /_matrix/client/r0/login HTTP/1.1" "curl/7.64.1" [0 dbevts]

This would transform to (note that whitespace was added for visibility, normally this would be a single line with no whitespaec between JSON separators):

{
    "log": "- - 8080 - {None} Processed request: 0.000sec/-0.000sec (0.000sec, 0.000sec) (0.000sec/0.000sec/0) 285B 200 \"GET /_matrix/client/r0/login HTTP/1.1\" \"curl/7.64.1\" [0 dbevts]",
    "namespace": "synapse.access.http.8080",
    "level": "INFO",
    "time": 1603971360.76,
    "request": "GET-0",
    "scope": null,
    "server_name": "localhost:8480"
}

A few improvements we'll want to make:

  • The log line includes a formatted message, which makes it difficult to search in a structured way.
  • Currently logging a message with additional fields requires including the fields twice (using the standard logging flow and the extra keyword to the logger).
@matrixbot matrixbot changed the title Dummy issue Improve structured logging Dec 21, 2023
@matrixbot matrixbot reopened this Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant