Created
January 23, 2012 16:47
-
-
Save ssp/1664199 to your computer and use it in GitHub Desktop.
pazpar2 log analysis
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
# Try to grep rough usage information from a pazpar2 log: | |
# Count how often each service has been initialised and | |
# add a + to the service name if pz:allow is used. | |
# Both for current and archived logs | |
cat pazpar2.log | grep "command=init" | sed "s/.*search.pz2?command=init&service=\([-a-zA-Z0-9]*\)/\1/g" | sed "s/.pz:allow.*/+/g" | sort | uniq -c | |
zcat pazpar2.log.2.gz | grep "command=init" | sed "s/.*search.pz2?command=init&service=\([-a-zA-Z0-9]*\)/\1/g" | sed "s/.pz:allow.*/+/g" | sort | uniq -c | |
# Turn into a simplistic JSON file for CouchDB import | |
echo '{"docs":[' > couch.json; cat pazpar2.log | grep "command=\(init\|search\)" | sed "s/\(.*\) pazpar2 .*search.pz2?\(.*\)/{\"date\":\"\1\",\"request\":\"\2\"},/g" >> couch.json; echo ']}' >> couch.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment