We have a accounting/billing system, based on Squid on FreeBSD 4.x/5.x. Squid writes its access.log to a "named pipe" (created by command "mkfifo"). A separate daemon reads data from this pipe, and communicates with the database, decreaseing users' limits after they download something.
However, we discovered, that a user with small non-zero traffic limit can download any 1 file, even if he has not enough limit. For example, a user with $0.01 can download a huge ISO-image (of course, if TCP connection won't break), because the record about it is written to access.log AFTER he downloads it. Is there a way solve this problem? I think about a patch for Squid, which will make it write a record after every N bytes of downloaded data (or every N minutes) in every session. If there's no better solution, please help to write this patch. I can test it immediately.