LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   postgres+syslogng+logrotation problem (https://www.linuxquestions.org/questions/linux-general-1/postgres-syslogng-logrotation-problem-297034/)

emailssent 03-03-2005 12:44 AM

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
-rw-r--r--    1 root    root            0 Feb 28 20:16 postgres.log.21
-rw-r--r--    1 root    root          10M Feb 28 20:15 postgres.log.22
-rw-r--r--    1 root    root            0 Feb 28 17:04 postgres.log.23
-rw-r--r--    1 root    root          10M Feb 28 17:03 postgres.log.24
-rw-r--r--    1 root    root            0 Feb 28 13:52 postgres.log.25
-rw-r--r--    1 root    root          10M Feb 28 13:51 postgres.log.26
-rw-r--r--    1 root    root            0 Feb 28 10:56 postgres.log.27
-rw-r--r--    1 root    root          10M Feb 28 10:55 postgres.log.28
-rw-r--r--    1 root    root            0 Feb 28 08:40 postgres.log.29
-rw-r--r--    1 root    root            0 Mar  2 00:12 postgres.log.3

That's after rotation it generates two files one with 0MB size and another with is of 10MB, so, why it is generating 0MB size log files??

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

acid_kewpie 03-07-2005 04:41 PM

what does the relevant logrotate file say?

emailssent 03-07-2005 10:56 PM

Quote:

what does the relevant logrotate file say?
Plz. explain ?? for which file you would like to know? And thanks for taking initiative in helping me!



-jack

acid_kewpie 03-08-2005 01:21 AM

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

emailssent 03-08-2005 02:55 AM

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

acid_kewpie 03-09-2005 02:44 PM

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.

acid_kewpie 03-09-2005 02:45 PM

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.

emailssent 03-09-2005 11:38 PM

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

deoren 04-11-2005 05:27 PM

It looks like your issue is the syntax:

Quote:

/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 {
The first entry is matching all of the logs, including the one that was just created because of the rotate.

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.