Created
November 23, 2010 11:36
-
-
Save kennon/711633 to your computer and use it in GitHub Desktop.
A gawk script for tailing Rails 2.3.x logfiles to show more condensed output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env gawk | |
# rails_log_tailer.gawk | |
# usage: tail -f log/production.log | gawk -f rails_log_tailer.gawk | |
# This gives you a nice condensed 1 line output from the Rails logfile | |
BEGIN { RS = "" } | |
/^Processing/ { | |
match($0, /Processing ([a-zA-Z#]+)/, processing) | |
match($0, /Completed in ([0-9]+)ms \((View: [0-9]+, )?DB: ([0-9]+)\) \| ([0-9]+) [a-zA-Z]+ \[(.*)\]/, completed) | |
match(completed[2], /View: ([0-9]+)/, view) | |
printf "%3s %4sms %-30s %4sms %4sms %s\n", completed[4], completed[1], processing[1], view[1], completed[3], completed[5], completed[6] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment