Skip to content

Instantly share code, notes, and snippets.

@mitsuru793
Created February 4, 2016 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitsuru793/d793fd48af8126321f3a to your computer and use it in GitHub Desktop.
Save mitsuru793/d793fd48af8126321f3a to your computer and use it in GitHub Desktop.
railsのログファイルからアクセスのあった日付を列挙
cat log/production.log \
| cut -d ' ' -f2 | awk '{print substr($0, 2, 10)}' \
| grep -v '^\s*$' \
| grep -E '[0-9]{4}-[0-9]{2}-[0-9]{2}' \
| uniq
# =>
# 2016-01-09
# 2016-01-08
# 2016-01-09
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment