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

Matomo application logs can now be written in syslog #9400

Closed
Vebryn opened this issue Dec 16, 2015 · 5 comments
Closed

Matomo application logs can now be written in syslog #9400

Vebryn opened this issue Dec 16, 2015 · 5 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Milestone

Comments

@Vebryn
Copy link

Vebryn commented Dec 16, 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
Copy link
Member

tsteur commented Dec 16, 2015

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

@tsteur tsteur added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label Dec 16, 2015
@mattab
Copy link
Member

mattab commented Dec 23, 2015

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

@mattab mattab added this to the Mid term milestone Dec 23, 2015
@mattab mattab modified the milestones: Long term, Mid term Dec 5, 2016
@mwithheld
Copy link
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
Copy link
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
Copy link
Member

Fixed in #17764

@mattab mattab changed the title add syslog log_writer Matomo application logs can now be written in syslog Jul 26, 2021
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

No branches or pull requests

5 participants