I'm just joining, and looking for a solution to my problem.
I have an app act as server which forward log data using telnet (server). And in my centos machine, act as a telnet client to capture the data, and an application called recorder which readd those log data and to process it then erase it.
I have googled but haven't any luck.
I have try this command using terminal : telnet ip_address port | tee /home/user/$(date +%Y%m%d%H%M%S).txt
My application (recorder) read this text file then erase it.
The problem is, the $(date +%Y%m%d%H%M%S).txt files never created again after erased. The data capture must not stop in anyway, so telnet (client) keep capturing the log.
If that file gets erased but is still held open and being written to by tee, it continues to exist in the filesystem. You might be lucky to recapture it with a file system debugger; or, before deleting it, create a second link in a directory.