@Vebryn opened this Issue on December 16th 2015

Hello,

log_writers currently supports screen, database and file.

syslog allows more flexibility in log management. Unix and Linux based distributions manage system logs and applications logs with rsyslog or syslog-ng component. Rsyslog manages and stores logs. It enhances security by centraling log management.

Pros :

  • No more file rotation needed
  • No more database log table purge
  • No more logs into web application dir
  • Centralized log management

Is it possible to add syslog log_writer ?

Configuration implementation example :
[log]
log_writers[] = syslog

Code implementation example :
http://php.net/manual/fr/function.syslog.php

Thank you,

Best regards.

@tsteur commented on December 16th 2015 Member

:+1: I was waiting for that since I started working with Piwik and am surprised that it is still not there :+1: :+1: :+1: definitely needed for a proper logging setup

@mattab commented on December 23rd 2015 Member

@Vebryn Thanks for the suggestion, a pull request would be very welcome :-)

@mwithheld commented on July 8th 2021 Contributor

+1 on this please

Ref https://stackoverflow.com/questions/28591433/laravel-monolog-syslog-specify-individual-log-file for another example.
Ref https://github.com/Seldaek/monolog/blob/main/src/Monolog/Handler/SyslogHandler.php for the

I can code up a pull request, but I'm not familiar with Matomo code -- can someone point me at where the SyslogHandler should be added, or analogous code for the DB/file logging setup?

@diosmosis commented on July 8th 2021 Member

Hi @mwithheld, a pull request would be appreciated, though technically this should be possible currently via dependency injection. You could add the handler by adding the following to the config/config.php file (create it if it's not there):

<?php

return [
    SyslogHandler::class => \DI\object()->constructor('ident...');

    'log.handlers' => \DI\decorate(function ($previous, ContainerInterface $container) {
        $previous[] = $container->get(SyslogHandler::class);
    }),
];

If you want to create a PR that allows setting it via INI config, you'd have to add an entry to 'log.handler.classes' in Monolog/config/config.php.

@diosmosis commented on July 18th 2021 Member
This Issue was closed on July 18th 2021
Powered by GitHub Issue Mirror