Start this script with a tail pipe as stdin, e.g.:
$ tail -F /tmp/access.log | ./chop_up_log.sh
The three variables at the start are parameter. As soon as $BATCH_SIZE
lines are read,
a batch is written to disk. As soon as the read process has waited $TIMEOUT_SECONDS
seconds,
and there is data in the buffer, a batch is written to disk.
This script can be used, for example, to read a web server's access log and write small files to a Flume SpoolDir source.