Skip to content

Instantly share code, notes, and snippets.

@JCotton1123
Last active August 24, 2024 06:55
Show Gist options
  • Save JCotton1123/7015737 to your computer and use it in GitHub Desktop.
Save JCotton1123/7015737 to your computer and use it in GitHub Desktop.
Parse php-fpm slow log
## Slow requests grouped by function call
cat /var/log/php-fpm/www-slow.log | grep -A 1 script_filename | \
grep -v script_filename | grep -v -e "--" | cut -c 22- | sort | uniq -c | sort -nr
## Slow requests grouped by minute
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | \
cut -d' ' -f2 | sort | cut -d: -f1,2 | uniq -c
## Top 25 1 minute groups of slow requests
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | cut -d' ' -f2 | \
sort | cut -d: -f1,2 | uniq -c | sort -nr | head -n 25
@RDelorier
Copy link

Thank you sir 👍

@gabrielef
Copy link

Thank you!

@vlad88sv
Copy link

Very useful, thank you

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