You can use this script to separate a very large Rails log file into serveral files by date very quickly.
The Rails log file may have special characters that mawk awk
may not work well with.
It is highly recommended to use gawk
instead.
# this would print a shell script
gawk -f log.awk production.log
# run directly
gawk -f log.awk production.log | bash
The Rails log file may look like this:
I, [2014-09-10T00:00:52.413000 #5702] INFO -- : Completed 200 OK in 2ms ...