Sample Header Ad - 728x90

What could cause a log file to be trunctated during writing?

0 votes
1 answer
1129 views
In my workplace, I've inherited the responsibility of managing a web server. It's a CentOS Linux virtual machine, running on Amazon AWS EC2. Alongside serving web pages, there is a pile of scheduled tasks, background processing and database operations that happen. Just now I was manually running a Bash script that calls Oracle SQL*Plus, which reads a SQL script with a load of UPDATE statements and calls to refresh materialized views. Maybe none of that is relevant, but I wanted to give some context. The Bash script writes output to a log file in /tmp, and I was using the command tail -f output.log to monitor the output. It was running for a long time - maybe 20 minutes - with output slowly appearing in my terminal, but then I got a message: tail: output.log: file truncated and the Bash script stopped running. The log file exists in /tmp but it has size 0. I was hoping to go through the log file in detail to see what DB errors were reported, so I could fix things. My question is, what could cause this file truncation to happen? I don't think the file itself was very big - only something like 200 lines. This is all kind of new to me, and I don't really know where to start, or what to suspect as potentially problematic.
Asked by osullic (235 rep)
Dec 9, 2019, 03:28 PM
Last activity: Dec 9, 2019, 03:47 PM