Created
May 18, 2016 10:35
-
-
Save lukasmartinelli/dcd8b14ada1617fd3c3884894655cf56 to your computer and use it in GitHub Desktop.
Filter NGINX for requests longer than 10 seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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