I wonder is there a programme that'll do what I want. This is like an streaming log rotation programme. For the linux/unix command line.
Let's say I have some input that is streaming some data. I want to write it a file, but a different file per day (or hour or whatever), i.e. open a file with a specified datetime based pattern, and write the contents of stdin to that file. when the day changes (or the hour or the minute, or the week etc), close that file, then re-open a new one (which will have a new filename), and write lines to that file instead?
So something like:
my long | process | that's generating | input | datestampfilewriter --daily 'output.%Y-%m-%d.txt'
Does this tool exist?
You could use cronolog.
How about
logger
? Logs to syslog, which is "datestampped" and can belogrotate
d.And with the
-f
option logs to a file. Seeman logger
.