0

Due some Bug testings there are tons of request made to my squid server on debian. Because it is a test i can't disable logging, restart the Server or block the requests. Due the growing size of the logfile i decided to delete it while writing. Squid did not create a new one (first with the next restart).

I tried to figure out what happens now in the background, is this data still written somewhere to the harddisk or what is happening in such a szenario? I'm mostly worried because i have an NVME Drive.

Deex
  • 131
  • 7

2 Answers2

2

In general, if a file is open, and you delete that file, its data remains on the disk while at least one process holds the file open. Data written to such files will be written to the file system, so a file deleted in this way consumes filesystem space, and will continue to grow until all file handles are released.

You should reload squid by using systemctl reload squid or squid -k reconfigure after you delete the file. This will make squid reinitialize without actually restarting, which includes reopening the log files, freeing the old handle in the process.

Lacek
  • 7,233
  • 24
  • 28
1

Yes. As long as the Squid process has its file handle it can write to it and the data gets written to disk. -- At the same time you can do manual move/remove/link operations, but these external actions do not affect the running process.

Related remark, not for Squid: this is also why syslogd supports signals to re-open all active logfiles, the function is necessary for logrotate (or similar tools) to get control over the old logfiles.

mschuett
  • 3,146
  • 21
  • 21