
I was recently asked by a client for a snippet of Linux CLI that I use to get a summary of Magento reports files under var/reports. I don’t guarantee that this is the best CLI command, but this is what I use
head -n 1 * | grep -v == | grep -v -e '^$' | awk -F \" '{ print $2 }' | sort | uniq -c | sort -n 1 SQLSTATE[HY000] [1049] Unknown database 'magento19' 1 SQLSTATE[HY000] [2002] Connection refused 2 Cannot send headers; headers already sent in , line 0 3 SQLSTATE[HY000] [2002] No such file or directory
If you want to format it so you can copy and paste into Excel (for charting)
head -n 1 * | grep -v == | grep -v -e '^$' | awk -F \" '{ print $2 }' | sort | uniq -c | sort -n | sed 's/^ *//;s/ *$//' | awk '{ a=$1;sub("[^"FS"]+["FS"]+",""); printf "\"%s\",%d\n", $0, a}'
If you only want to check the last 1000 reports
head -n 1 `ls -t | head -n 1000` | grep -v == | grep -v -e '^$' | awk -F \" '{ print $2 }' | sort | uniq -c | sort -n
Feel free to post corrections or other useful CLI commands in the comments if you like.
Comments
Community News: Recent posts from PHP Quickfix (11.04.2015) | PHP Boutique
[…] How to examine the reports files for Magento | ESchrade – Kevin Schroeder’s Blog #phpquickfix, #magento, #report, #files, #examine […]