1

I have this dusty syslog-ng 3.1.3 that writes to a database and all is working well however it seems to keep only 30 days of logs (last table is logs20150826) How can I increase that? I see nothing immediately clear in the documentation.

There are some references in logrotate dirs but nothing that seems to be controlling the mysql destination and nothing in /etc/syslog-ng/syslog-ng.conf so this 30 day retention must be some kind of default.

Recct
  • 370
  • 1
  • 3
  • 22

1 Answers1

2

Check if you have php-syslog-ng installed, syslog-ng isn't responsible for this.

Log rotation

Log rotation should be part of most installations where you use php-syslog-ng. It is better to use log rotation than deleting rows in the main table because deleting rows can lead to performance problems. Rotating old logs out of the main table will also usually result in better performance because the tables with old logs are static and can be optimized. There is a logrotate.php script in the scripts directory. You may have to edit it to enter the correct path to your php-syslog-ng installation but after that it should be ready for use. If you enable merge tables in the config.php file then a merge table of all log tables will be created at the end of the script. The merge table will allow you to search across all tables instead of having to do searches against one table at a time. The merge table does equate to a slight performance hit on the search form because the fields are populated based on all tables instead of one particular table.

You can also specify enable the LOGRETENTION setting in config.php. If you enable this then logs older than this setting will be dropped whenever the logrotate.php is run.

If you decide to use the logrotate.php script then just add it to your crontab and have it run however frequent you want (max is currently one time per day).

Source http://www.debianhelp.co.uk/syslog-ng.htm

Jacob Evans
  • 7,886
  • 3
  • 29
  • 57
  • ..So logrotate goes on mysql every day and creates a new log table for syslog-ng to insert into? I certainly cant find anything that does that in `/etc/logrotate.d` or `/etc/logrotate.conf` – Recct Sep 25 '15 at 13:04
  • sorry I didn't read the entire question, syslog-ng does not do rotation/cleanup so it would be a 3rd party utility. – Jacob Evans Sep 25 '15 at 14:13
  • 1
    Yep! there was a setting in `/var/www/php-syslog-ng/html/config/config.php` with `define('LOGROTATERETENTION', 30);` – Recct Sep 25 '15 at 14:32
  • Also If you haven't tried it yet, graylog is awesome! – Jacob Evans Sep 25 '15 at 15:09
  • Heh ok, and yes that thing definitely needs attention (=scrap and replace with something modern that is hah) – Recct Sep 25 '15 at 15:16
  • You'll get he retention you want without the degradation of performance, plus you can do streaming and alerts to hipchat/pagerduty/email and that's just awesome – Jacob Evans Sep 25 '15 at 15:17
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/29535/discussion-between-jacob-evans-and-recct). – Jacob Evans Sep 25 '15 at 15:31