Skip to content

Instantly share code, notes, and snippets.

@yuya-takeyama
Created February 8, 2011 05:47
Show Gist options
  • Save yuya-takeyama/815945 to your computer and use it in GitHub Desktop.
Save yuya-takeyama/815945 to your computer and use it in GitHub Desktop.
Colorizes your Apache's access logs.
#!/usr/bin/env ruby
STDIN.each do |line|
puts line.sub(/"(?:(PUT|POST|GET|HEAD|DELETE|OPTIONS) ([^\s]*)) (HTTP\/\d\.\d)" (\d+)/, "\"\e[1;31m\\1\e[0m \e[1;32m\\2\e[0m \\3\" \e[1;33m\\4\e[0m")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment