Here’s a quick and handy “awk” snippet to extract data from Nginx’s access or error log file for the past hour/s.
# awk -v d1="$(date --date '-60 min' '+%d/%b/%Y:%T')" '{gsub(/^[\[\t]+/, "", $4);}; $4 > d1' /var/log/nginx/access.log
This example shows how to extract data from /var/log/nginx/access.log for the past 60 minutes – ‘-60 min’.