postgres+syslogng+logrotation problem
Dear All,
I facing problem in my log rotation for postgres, it is not rotation properly. I am using syslog-ng package for loging. My logs for postgres looks like this, Code:
-rw-r--r-- 1 root root 10M Feb 28 23:24 postgres.log.20 Does it supports syslogng package for loging? If yes then what is the difference is its configuration from normal syslog package. Any help appreciated. -jack |
what does the relevant logrotate file say?
|
Quote:
-jack |
well assuming that logrotate is still responsible for the rotation under syslog-ng, and it is on my system, then you should have a config for that rotation at /etc/logrotate.d/postgres or such like. it's the rules defined there that will do arbitrary rotation on any file if it does not do it's own rotation
|
Thanks for listening!
# vi /etc/logrotate.d/syslog /var/log/*.log /var/log/messages /var/log/cups /var/log/cron /var/log/dmesg /var/log/ksyms /var/log/maillog /var/log/postgres.log { sharedscripts postrotate /bin/kill -HUP `cat /var/run/syslog-ng.pid 2> /dev/null` 2> /dev/null || true endscript } # vi /var/lib/pgsql/data/postgresql.conf # - Syslog - syslog = 1 # range 0-2; 0=stdout; 1=both; 2=syslog syslog_facility = 'LOCAL0' syslog_ident = 'postgres' --------- ----------- Plz. have a look at postgresql.conf file also becz. it is redirecting its logs to stdout and syslog where i not using syslog , i am using syslog-ng . So, any idea from this. Since it is redirecting its log in two places stdout and syslog , might be becz. of this reason it is generating two files, but as it is my live server i can't test on it by changing the parameter values. so, any idea. -jack |
syslog-ng is still providing the same hooks into the logging substructure, it's just a different implementation.
what's happening to the other logs in the syslog file? is there an /etc/logrotate.d/postgres? i'd imagine there might be, and so one log would be rolled twice in each run... one with data, one without. Actually as those logs as clearly being rotated on size, not age, i don't think that's actaully logrotate at all, instead postgres is handling it itself. have another look at your postgres.conf, particulary for any defaults about these suckers: http://www.postgresql.org/docs/curre...-LOGGING-WHERE and if it is rotating itself, i'd remove that logrotate entry for good housekeeping. |
also a 10mb log file is pretty lame really.. i'd suggest bumping it up a little, and ensure fewer logs are maintained. both those values are internal to postgres.
|
Thanks for listening.
other log files are ok they are increasing day by day rotating properly. no there is no /etc/logrotate.d/postgres, it is defined in /etc/logrotate.d/syslog and the link that u provided is for postgres 8 where i am using 7.4 and which doen't supports log_destination parmeter. And i tried to configure similar scenario on my local system and it is working fine, only single file where generated for posgres and log rotation is also working fine. only diff. in this configuration is that here i am using postgres7.3 whereas on my live server postgres 7.4 is configured. So, and idea which i can try to resolve the issue. -jack |
It looks like your issue is the syntax:
Quote:
Do man logrotate for all of the options. I would suggest adding this option to that file after you fix your log sources: notifempty When you go to fix your sources I would almost seperate all of those sources into their own config file so you can manage each one seperately. I have my logs mailed to me, but I don't want all of them mailed. By putting each into it's own block I can choose which get mailed. This line in my /etc/logrotate.conf file does this: Code:
include /etc/logrotate.d |
All times are GMT -5. The time now is 06:39 PM. |