Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2002
    Location
    Toronto, Canada
    Posts
    76

    Unanswered: Log file management

    I would like to pipe postmaster's stderr to a log file so that I could do the following:

    pg_ctl start | logrotate

    (As suggested in the postgresql administration guide, section 8.3) What do I need to change to make it work?

    I'm currently thinking of using the logrotate script that comes with unix. (I saw the following file /etc/logrotate.conf, and I'm able to do a 'man logrotate')

  2. #2
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    don't know

    I have not done this before

    but I'm working with the following scenario

    pg_ctl -l logfile start

    cron job every day

    shell script for backuping the logfiles
    tar cfvz log_[TIMESTAMP].tgz logfile
    scp ....

    it's a basic solution but effective
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  3. #3
    Join Date
    Sep 2002
    Location
    Toronto, Canada
    Posts
    76
    what command should I call when I do the daily cronjob?

  4. #4
    Join Date
    Mar 2002
    Location
    Pilipinas
    Posts
    36

    compile postgres with-syslog

    in my linux machine...i configure it this way...

    try configuring your postgresql from tar and owned the extracted folder by user postgres then as postgres use this command:
    --> ./configure --enable-syslog
    --> make
    --> make check (for database testing)
    --> make install (i suggest, use "checkinstall")
    --> /~home_postgres/bin/initdb -D /database/directory/
    --> cd /etc/rc.d/init.d/
    --> cp /usr/local/src/postgresql7.x.x/contrib/start-scripts/linux ./postgresql
    --> chmod 755 postgresql
    --> chkconfig --add postgresql

    add or change:
    --> /data/directory/postgresql.conf (change)
    --> uncomment syslog
    --> syslog = 2
    --> /etc/syslog.conf (add)
    --> #PostgreSQL
    --> local0.* /var/log/postgreSQL.log
    --> /etc/logrotate.d/syslog (add)
    --> /var/log/postgreSQL.log /var/log/messages .... (and so on)

    start/restart service (syslog, postgresql)
    thats all...

    Good Luck!!!
    --- Hey! its me!!! the MaleMan ---

  5. #5
    Join Date
    Sep 2002
    Location
    Toronto, Canada
    Posts
    76
    I don't want to recompile postgres.

    I just want to redirect the output of postmaster into a log that rotates.

  6. #6
    Join Date
    Mar 2002
    Location
    Pilipinas
    Posts
    36

    cron job

    like Eperich told you, u can create some simple scripts to do the job then call that script by cron.

    i dont really have experience n unix machines but they said that it is almost the same with linux..

    --- Hey! its me!!! the MaleMan ---

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •