Skip to content

Instantly share code, notes, and snippets.

@lukasmartinelli
Created May 18, 2016 10:35
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 lukasmartinelli/dcd8b14ada1617fd3c3884894655cf56 to your computer and use it in GitHub Desktop.
Save lukasmartinelli/dcd8b14ada1617fd3c3884894655cf56 to your computer and use it in GitHub Desktop.
Filter NGINX for requests longer than 10 seconds
import fileinput
import sys
for line in fileinput.input():
tokens = line.split('"-"')
time_tokens = tokens[-1].strip().split(' ')
try:
nginx_time, php_time = float(time_tokens[0]), float(time_tokens[1])
except ValueError:
continue
if php_time > 10.0:
sys.stdout.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment