# HG changeset patch # User Chris Cannam # Date 1351173286 -3600 # Node ID a97e573d7f87bd9d0548a37fb523b3b679be7a57 # Parent 6edb748be0640e2a7015ddd45dc738b06864d6cd Minor fixes diff -r 6edb748be064 -r a97e573d7f87 extra/soundsoftware/get-apache-log-stats.rb --- a/extra/soundsoftware/get-apache-log-stats.rb Thu Oct 25 14:25:43 2012 +0100 +++ b/extra/soundsoftware/get-apache-log-stats.rb Thu Oct 25 14:54:46 2012 +0100 @@ -41,6 +41,9 @@ def is_public_project?(project) if !project false + elsif project =~ /^\d+$/ + # ignore numerical project ids, they are only used when editing projects + false elsif @projects.key?(project) @projects[project].is_public? else @@ -58,7 +61,7 @@ def print_stats(h) h.keys.sort { |a,b| h[b] <=> h[a] }.each do |p| if h[p] > 0 - print h[p], " ", @projects[p].name, "\n" + print h[p], " ", @projects[p].name, " [", p, "]\n" end end end @@ -69,9 +72,10 @@ # most annoyingly, the parser can't handle the comma-separated list # in X-Forwarded-For where it has more than one element. If it has - # failed, remove any IP addresses with trailing commas and try again + # failed, remove any IP addresses or the word "unknown" with + # trailing commas and try again if not record - filtered = line.gsub(/([0-9]+\.){3}[0-9]+,\s*/, "") + filtered = line.gsub(/(unknown|([0-9]+\.){3}[0-9]+),\s*/, "") record = parser.parse(filtered) end