Ah! This is a continuation of your Slow reponse >xev | grep keyPress thread
. A good try but I don't think it will work because I theorise xev itself is doing the buffering; it probably checks where its stdout is going then, if it is a terminal, does not buffer it (or line buffers it) or, if it is to pipe or file, buffers it. If my theory is correct there are two options; modifying xev source (possible and an interesting exercise) or run xev with output to terminal and intercept the data. The bootlogd executable does something along those lines.