How to limit log file size with syslog-ng?
Hi all experts,
I have a self-made application running on a small embedded Linux device (which should not matter) using syslog to output some error, warning or debug logs. There is a "better" syslog daemon installed, called syslog-ng, which have some more features, but I miss a very important one: How to limit the size of the logfiles to some dedicated megabytes. I was able to create rotating logfiles with the configuration in syslog-ng.conf: Code:
destination testlog { Is there a possibility to limit the size of each file to e.g. 10Mb and cut the oldest part of the file? Here is my environment:
Thanks Achim |
I don't know how much help this will be, as you mention that you are embedded, but I personally use "logrotate" to manage rotation of my "syslog-ng" logs. "logrotate" does allow you to limit sizes of files, but will only run periodically, or when called... so your file could grow larger in the few moments between a cron-poll for example. This is a very typical usage scenario though, as often logs are written to fixed partitions, etc. Unfortunately as far as the standard "syslog-ng" goes, there is no log-size option/limiter (reference: man 5 syslog-ng.conf)
|
My approach was not to use logrotate, because of this article. But it looks like in my case is no way around it.
Thanks for the answer Achim |
All times are GMT -5. The time now is 07:09 AM. |