1

My pgbouncer.log grows endlessly.

How do I enable filename rollover or limit the logfile size for pgbouncer on Ubuntu?

4
  • I remember that we used rotate on Linux to do that. (rotate by date & size).
    – Luan Huynh
    Dec 12, 2016 at 10:12
  • @LuanHuynh: did you specify that in pgbouncer.ini or something? Would appreciate the details. Dec 12, 2016 at 10:14
  • Over two years ago, we didn't use pgbouncer.ini to rotate logs because pgBouncer didn't support rotate logs (as PostgreSQL). That's why we had to use rotate log of Linux. In terms of rotate log Ubuntu, in fact, I didn't remember in details, however, please review digitalocean.com/community/tutorials/… , I think that web can help you.
    – Luan Huynh
    Dec 12, 2016 at 10:20
  • Well, I think you can read this blog "raghavt.blogspot.com/2016/08/…".
    – Luan Huynh
    Dec 12, 2016 at 10:27

1 Answer 1

1

Until now, pgBouncer doesn't support rotate log. Hence, you have to do it by yourself.

You can refer to sites below:

How to rotate PgBouncer logs in Linux/Windows ?

How To Manage Log Files With Logrotate On Ubuntu 12.10

5
  • 1
    I used logrotate to take care of it. But there's still a problem, perhaps you can help? After changing the desired logging level to size 100M, I forced logrotate via logrotate -f. As a result of that, I'm seeing: error writing to /var/log/postgresql/pgbouncer.log.1: No data available. I.e log rotation has failed! When I do tail -f pgbouncer.log, I see a ton of log lines being generated in real time, so logging is still going on, but logrotation thinks there's no data available. What to do!? Dec 12, 2016 at 10:58
  • Should I create an empty pgbouncer.log.1 and retry? Dec 12, 2016 at 10:59
  • How about your pgbouncer.log configuration file? (linuxcommand.org/man_pages/logrotate8.html) . Please test before applying to production env.
    – Luan Huynh
    Dec 12, 2016 at 11:10
  • In pgbouncer.ini (the configuration file), I can only configure the location of the log files, not their rotation credentials. Dec 12, 2016 at 11:27
  • pgbouncer.log as this blog: raghavt.blogspot.com/2016/08/…. it is not pgbouncer.ini
    – Luan Huynh
    Dec 12, 2016 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.