LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-03-2005, 12:44 AM   #1
emailssent
Member
 
Registered: Sep 2004
Posts: 312

Rep: Reputation: 30
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
 
Old 03-07-2005, 04:41 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
what does the relevant logrotate file say?
 
Old 03-07-2005, 10:56 PM   #3
emailssent
Member
 
Registered: Sep 2004
Posts: 312

Original Poster
Rep: Reputation: 30
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
 
Old 03-08-2005, 01:21 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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
 
Old 03-08-2005, 02:55 AM   #5
emailssent
Member
 
Registered: Sep 2004
Posts: 312

Original Poster
Rep: Reputation: 30
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
 
Old 03-09-2005, 02:44 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 03-09-2005, 02:45 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 03-09-2005, 11:38 PM   #8
emailssent
Member
 
Registered: Sep 2004
Posts: 312

Original Poster
Rep: Reputation: 30
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
 
Old 04-11-2005, 05:27 PM   #9
deoren
Member
 
Registered: Oct 2003
Location: USA
Distribution: Ubuntu
Posts: 216

Rep: Reputation: 30
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postgres Login Problem aarajthomas Linux - Security 3 12-08-2005 08:00 AM
Problem with Postgres Database Connection anjani.78 Linux - Software 1 10-07-2005 02:06 AM
php postgres problem Xing Linux - Software 3 03-08-2004 12:22 PM
Postgres installation initdb problem bruce64 Linux - Software 3 10-16-2003 01:55 PM
logrotation cuss Linux - General 3 02-17-2003 01:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration