Skip to content

Instantly share code, notes, and snippets.

@gb-swatanabe
Created January 20, 2014 06:54
Show Gist options
  • Save gb-swatanabe/8516063 to your computer and use it in GitHub Desktop.
Save gb-swatanabe/8516063 to your computer and use it in GitHub Desktop.
タイムスタンプがUNIXTIME形式のログ(ex:Squidのaccess.log)をtail -fする際にhuman-readableに変換するワンライナ
sudo tail -100f /var/log/squid3/access.log | ruby -rdate -pe 'BEGIN{$stdout.sync=true; trap(:INT){exit}}; $_.sub!(/^\d+/,Time.at($&.to_i).strftime("[%Y-%m-%d %T]"))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment