Skip to content

Instantly share code, notes, and snippets.

@groman-me
Created October 22, 2013 16:46
Show Gist options
  • Save groman-me/7104015 to your computer and use it in GitHub Desktop.
Save groman-me/7104015 to your computer and use it in GitHub Desktop.
ruby regexp to parse line of nginx conf
(\d+.\d+.\d+.\d+)\s-\s-\s\[(.+)\]\s"GET\s(.+)\s\w+\/.+"\s\d+\s\d+\s"(.+)"\s"(.+)"
@groman-me
Copy link
Author

to parse date in ruby

DateTime.strptime("22/Oct/2013:00:38:00 +0300", "%d/%b/%Y:%H:%M:%S %z").to_time.getgm.to_date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment