I have a service that runs all the time and also stores a log file. It basically adds new lines to the log file every few seconds. I wrote a small file that reads these lines and then analyzes them for various actions. I have a question, how to delete lines that I have already analyzed from the log file without violating the log file entry by the service?
Usually, when I need to delete a line in a file, I open the source and temporary, and then just write all the lines to the temporary file, except for the original that I want to delete. Obviously, this method will not speak here.
So how can I remove them?
source
share