sample_log_config.yaml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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/library/logging.config.html#configuration-dictionary-schema
  10. # [2]: https://matrix-org.github.io/synapse/latest/structured_logging.html
  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.
  24. # WARNING/ERROR logs will still be flushed immediately, but there will be a
  25. # delay (of up to `period` seconds, or until the buffer is full with
  26. # `capacity` messages) before INFO/DEBUG logs get written.
  27. buffer:
  28. class: synapse.logging.handlers.PeriodicallyFlushingMemoryHandler
  29. target: file
  30. # The capacity is the maximum number of log lines that are buffered
  31. # before being written to disk. Increasing this will lead to better
  32. # performance, at the expensive of it taking longer for log lines to
  33. # be written to disk.
  34. # This parameter is required.
  35. capacity: 10
  36. # Logs with a level at or above the flush level will cause the buffer to
  37. # be flushed immediately.
  38. # Default value: 40 (ERROR)
  39. # Other values: 50 (CRITICAL), 30 (WARNING), 20 (INFO), 10 (DEBUG)
  40. flushLevel: 30 # Flush immediately for WARNING logs and higher
  41. # The period of time, in seconds, between forced flushes.
  42. # Messages will not be delayed for longer than this time.
  43. # Default value: 5 seconds
  44. period: 5
  45. # A handler that writes logs to stderr. Unused by default, but can be used
  46. # instead of "buffer" and "file" in the logger handlers.
  47. console:
  48. class: logging.StreamHandler
  49. formatter: precise
  50. loggers:
  51. synapse.storage.SQL:
  52. # beware: increasing this to DEBUG will make synapse log sensitive
  53. # information such as access tokens.
  54. level: INFO
  55. root:
  56. level: INFO
  57. # Write logs to the `buffer` handler, which will buffer them together in memory,
  58. # then write them to a file.
  59. #
  60. # Replace "buffer" with "console" to log to stderr instead.
  61. #
  62. handlers: [buffer]
  63. disable_existing_loggers: false