Skip to content

Instantly share code, notes, and snippets.

@KarimJedda
Created June 11, 2020 18:53
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 KarimJedda/da3c3c51653716da5c3947e50908b4d3 to your computer and use it in GitHub Desktop.
Save KarimJedda/da3c3c51653716da5c3947e50908b4d3 to your computer and use it in GitHub Desktop.
Piping Nginx logs to AWK and format
# Get all the logs
tail -f /var/log/nginx/access.log |
# Extract IP and Timestamp for example
awk '{print $1 " " substr($4, 2, length($4) - 7)}' FPAT='[^ ]*|"[^"]*"|\\[[^]]*\\]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment