Can an active Postgres serverlog be truncated? Running Postgres 9.1 on Ubuntu 14.10 LTS.

I've got an application running on a machine that's going to run out of diskspace soon.  However, the application is in the middle of a crucial run that has taken 6 days thus far, and canceling it would mean another 6-day run.

I've deleted everything I can for which I have permissions, but I'd like to truncate the server log to free up some space.

If I were to copy the server log off and then do a cp /dev/null /database/serverlog would I risk causing the server to hang?  Or since the file reference has not changed, will it keep chugging along?

I realize the server log I copy off will have incomplete entries at the end and the new servlog will have incomplete entries at the beginning, so it's obviously not an optimal situation if I had to try to restore data using those files as there would be transactions missing.  However, I think the likelihood of actually needing to use the serverlog files before I have a chance to reconfigure and restart the server.
By default PostgreSQL logs to stderr, from PostgreSQL Documentation 18.8. Error Reporting and Logging:


  PostgreSQL supports several methods for logging server messages, including stderr, csvlog and syslog. On Windows, eventlog is also supported. Set this parameter to a list of desired log destinations separated by commas. The default is to log to stderr only. This parameter can only be set in the postgresql.conf file or on the server command line.


If you just direct stderr to file according to the documentation this means you have to stop and restart the server to truncate, 23.3. Log File Maintenance:


  If you simply direct the stderr of postgres into a file, you will have log output, but the only way to truncate the log file is to stop and restart the server. This might be acceptable if you are using PostgreSQL in a development environment, but few production servers would find this behavior acceptable.


About manually deleting the file, take a look at this thread from PostgreSQL mailing lists (from year 2010):


  What platform?  If in Unix/Linux, just:
  cat /dev/null > postgres_logfile
  or
  postgres_logfile
  Most running programs don't like it when you delete a file with an open file handle but you it doesn't mind if you clear it on the fly.  Not sure how to do this in a Windows environment.


And finally here's a good blog post more generally about PostgreSQL logs.