Обсуждение: var/log/postgresql deletion mystery Ubuntu 12.10
Hi, I have to create this directory each time I want to start the server. Something is deleting it when I close down or start up my laptop. Any suggestions as to what could be doing this, or how I could find out? I presently have version 9.1 installed. All I can add is "it used to work!". Since then I have upgraded to ubuntu 12.10 from 12.04 and installed mongodb amongst other things. Regards, Andy
Andrew Taylor <andydtaylor@gmail.com> writes: > I have to create this directory each time I want to start the server. > Something is deleting it when I close down or start up my laptop. > Any suggestions as to what could be doing this, or how I could find out? I > presently have version 9.1 installed. > All I can add is "it used to work!". Since then I have upgraded to ubuntu > 12.10 from 12.04 and installed mongodb amongst other things. Over in Fedora-land they've recently switched to a scheme whereby most "temporary" directories are deleted at reboot, so that packages need to arrange for their recreation. Is it possible something similar is going on in your newer Ubuntu version? It would seem to me to be the height of stupidity to flush log files this way, but it's hard to think of another reason for the directory to disappear. If all other stuff under /var/log is deleted or reset at reboot, then this could be the explanation. regards, tom lane
Here's what I did to fix this in Ubuntu 12.10. Now I cannot explain (a) why this problem came into being or (b) what the science is behind my fix. This was my first dive into Linux logs and there being seemingly an array of ways logging can be handled now, and was handled historically, with some variation across linux distributions. It's a little bewildering. All I can say it this works, and if someone can offer me insight into (postgres) logs in Ubuntu it would be appreciated. So here we go: Syslog seems to be one of the key processes available for logging. You can use this to determine what gets logged by given processes. In /etc/rsyslog.d/50-default.conf Add this line: local0.* -/var/log/postgresql/ And edit this line from this: daemon.*;mail.*;\ news.err;\ *.=debug;*.=info;\ *.=notice;*.=warn |/dev/xconsole To be this: daemon.*;mail.*;\ news.err;\ *.=debug;*.=info;\ *.=notice;*.=warn |/dev/xconsole;\ local0.none The above is based on information at this link: https://bowerstudios.com/node/890 Now (as if by magic) The /var/log/postgres directory is deleted and recreated on shutdown/startup, AND a postgresql-9.1-main.log file is created on reboot. On Fri, Feb 8, 2013 at 11:43 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Andrew Taylor <andydtaylor@gmail.com> writes: > > I have to create this directory each time I want to start the server. > > Something is deleting it when I close down or start up my laptop. > > > Any suggestions as to what could be doing this, or how I could find out? > I > > presently have version 9.1 installed. > > > All I can add is "it used to work!". Since then I have upgraded to ubuntu > > 12.10 from 12.04 and installed mongodb amongst other things. > > Over in Fedora-land they've recently switched to a scheme whereby most > "temporary" directories are deleted at reboot, so that packages need to > arrange for their recreation. Is it possible something similar is going > on in your newer Ubuntu version? It would seem to me to be the height > of stupidity to flush log files this way, but it's hard to think of > another reason for the directory to disappear. If all other stuff under > /var/log is deleted or reset at reboot, then this could be the explanation. > > regards, tom lane >
On Mon, Feb 11, 2013 at 6:36 AM, Andrew Taylor <andydtaylor@gmail.com> wrote: > Here's what I did to fix this in Ubuntu 12.10. > > Now I cannot explain (a) why this problem came into being or (b) what the > science is behind my fix. This was my first dive into Linux logs and there > being seemingly an array of ways logging can be handled now, and was handled > historically, with some variation across linux distributions. It's a little > bewildering. All I can say it this works, and if someone can offer me > insight into (postgres) logs in Ubuntu it would be appreciated. So here we > go: > > Syslog seems to be one of the key processes available for logging. You can > use this to determine what gets logged by given processes. > > In /etc/rsyslog.d/50-default.conf > Add this line: > local0.* -/var/log/postgresql/ I think that by adding this line, you now have the PostgreSQL startup script and syslog fighting over ownership of this directory. The Debian and Ubuntu packages pipe PostgreSQL's stderr here, and are not configured to use syslog nor PostgreSQL's builtin log rotation. -- Stuart Bishop <stuart@stuartbishop.net> http://www.stuartbishop.net/