Is there any way to make it so that when programs try to perform seek()
operations on a named pipe it will come back successful (but act as if the pipe was an empty file) instead of 'Illegal seek'?
I have every last little bit of logging on my system stored in an SQLite database, I don't have files anywhere. However there are a few programs that have trouble with this. There are 2 specific cases;
- A program wants to write to a log file which syslog-ng has created as a named pipe and is reading from. The program wants to perform a
seek()
for some reason and then fails. - A program (such as denyhosts or fail2ban) wants to read from a log file which syslog-ng has created as a named pipe and is writing to. The program wants to performs a
seek()
on it and fails.
Ideally I'd just like these seeks to behave as if the named pipe were just an empty file. I can't see any reason why a program writing a log would need to perform a seek anyway, it should just open the file for append and start writing. I can see why a program reading would want to seek, so that it could resume from its last position, and so I would like it to behave as if the file were empty (like it had been truncated).
So is there some option that can be set on named pipes to get them to behave this way? If not is there a mode that can be set when syslog-ng opens the pipe to have it behave this way (I'm open to making code changes)? Or am I up a creek?
F
command in less, it would be enough for less to refresh the screen if it doesn't get any output for a second or so. Making pipes seekable wouldn't help: the relevant difference there is thatF
goes to the end of the file, then waits for data to appear past the end — but for a pipe, the end of file only comes when the writer closes the file. – Gilles 'SO- stop being evil' Jan 29 '15 at 17:34