1
0

sample_log_config.yaml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Log configuration for Synapse.
  2. #
  3. # This is a YAML file containing a standard Python logging configuration
  4. # dictionary. See [1] for details on the valid settings.
  5. #
  6. # Synapse also supports structured logging for machine readable logs which can
  7. # be ingested by ELK stacks. See [2] for details.
  8. #
  9. # [1]: https://docs.python.org/3.7/library/logging.config.html#configuration-dictionary-schema
  10. # [2]: https://github.com/matrix-org/synapse/blob/master/docs/structured_logging.md
  11. version: 1
  12. formatters:
  13. precise:
  14. format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
  15. handlers:
  16. file:
  17. class: logging.handlers.TimedRotatingFileHandler
  18. formatter: precise
  19. filename: /var/log/matrix-synapse/homeserver.log
  20. when: midnight
  21. backupCount: 3 # Does not include the current log file.
  22. encoding: utf8
  23. # Default to buffering writes to log file for efficiency. This means that
  24. # will be a delay for INFO/DEBUG logs to get written, but WARNING/ERROR
  25. # logs will still be flushed immediately.
  26. buffer:
  27. class: logging.handlers.MemoryHandler
  28. target: file
  29. # The capacity is the number of log lines that are buffered before
  30. # being written to disk. Increasing this will lead to better
  31. # performance, at the expensive of it taking longer for log lines to
  32. # be written to disk.
  33. capacity: 10
  34. flushLevel: 30 # Flush for WARNING logs as well
  35. # A handler that writes logs to stderr. Unused by default, but can be used
  36. # instead of "buffer" and "file" in the logger handlers.
  37. console:
  38. class: logging.StreamHandler
  39. formatter: precise
  40. loggers:
  41. synapse.storage.SQL:
  42. # beware: increasing this to DEBUG will make synapse log sensitive
  43. # information such as access tokens.
  44. level: INFO
  45. twisted:
  46. # We send the twisted logging directly to the file handler,
  47. # to work around https://github.com/matrix-org/synapse/issues/3471
  48. # when using "buffer" logger. Use "console" to log to stderr instead.
  49. handlers: [file]
  50. propagate: false
  51. root:
  52. level: INFO
  53. # Write logs to the `buffer` handler, which will buffer them together in memory,
  54. # then write them to a file.
  55. #
  56. # Replace "buffer" with "console" to log to stderr instead. (Note that you'll
  57. # also need to update the configuration for the `twisted` logger above, in
  58. # this case.)
  59. #
  60. handlers: [buffer]
  61. disable_existing_loggers: false