puppetlabs / support-script-tooling

3 stars 5 forks source link

Add command to show largest reports #7

Closed m0dular closed 3 years ago

m0dular commented 3 years ago

I want to show the largest report sizes for agents. Please write a script to scrape Puppet server access logs for the largest report submitted per agent.

awk '$7 ~ "/report/" { split($7,s,"?"); n = split(s[1], t, "/"); if ($(NF-1) > seen[t[n]]) { seen[t[n]] = $(NF-1) }} END { for (i in seen) { print seen[i], i} }' logs/puppetserver/puppetserver-access.log | sort -rn | head
m0dular commented 3 years ago

Turns out I did this and forgot!