@mwithheld opened this Pull Request on July 8th 2021 Contributor

Issue #9400

Description:

Add log handlers syslog and errorlog

Review

  • [ ] Functional review done
  • [ ] Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
  • [ ] Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • [ ] Security review done see checklist
  • [ ] Code review done
  • [ ] Tests were added if useful/possible
  • [ ] Reviewed for breaking changes
  • [ ] Developer changelog updated if needed
  • [ ] Documentation added if needed
  • [ ] Existing documentation updated if needed
@diosmosis commented on July 11th 2021 Member

Hi @mwithheld, thanks for the contribution! Greatly appreciated.

@diosmosis commented on July 11th 2021 Member

Hi @mwithheld, sorry I just merged this then realized it won't work as is. I've left some review comments. Can you create a new PR w/ the changes?

@mwithheld commented on July 13th 2021 Contributor

That was silly of me - a fix is in PR #17746 along with adding the option to set the syslog ident.

Testing syslog:
In config.ini.php, add to the [log] section:

[log]
; possible values for log: screen, database, file, syslog, errorlog
log_writers[] = syslog

; log level, everything logged w/ this level or one of greater severity
; will be logged. everything else will be ignored. possible values are:
; ERROR, WARN, INFO, DEBUG
; this setting will apply to every log writer, if there is no specific log level defined for a writer.
log_level = DEBUG

; if configured to log to syslog, mark them with this identifier string.
; This acts as an easy-to-find tag in the syslog.
logger_syslog_ident = 'matomo'

Output in syslog looks like this (will vary depending on your syslog config)

2021-07-13T11:49:08.179-07:00 somesystemname syslog.debug matomo[567263]: DEBUG Piwik\Plugin\Manager[2021-07-13 18:49:08 UTC] [2b44b] Loaded plugins: CorePluginsAdmin, CoreAdminHome, ..., TreemapVisualization
2021-07-13T11:49:08.179-07:00 somesystemname syslog.debug matomo[567263]:

Testing errorlog:
In config.ini.php, add to the [log] section:

[log]
; possible values for log: screen, database, file, syslog, errorlog
log_writers[] = errorlog

; log level, everything logged w/ this level or one of greater severity
; will be logged. everything else will be ignored. possible values are:
; ERROR, WARN, INFO, DEBUG
; this setting will apply to every log writer, if there is no specific log level defined for a writer.
log_level = DEBUG

Output in errorlog looks like very similar to the above, depending on your config (without the syslog ident tag).

This Pull Request was closed on July 11th 2021
Powered by GitHub Issue Mirror