Revision 983:a97e573d7f87 extra

View differences:

extra/soundsoftware/get-apache-log-stats.rb
41 41
def is_public_project?(project)
42 42
  if !project
43 43
    false
44
  elsif project =~ /^\d+$/
45
    # ignore numerical project ids, they are only used when editing projects
46
    false
44 47
  elsif @projects.key?(project)
45 48
    @projects[project].is_public? 
46 49
  else
......
58 61
def print_stats(h)
59 62
  h.keys.sort { |a,b| h[b] <=> h[a] }.each do |p|
60 63
    if h[p] > 0
61
      print h[p], " ", @projects[p].name, "\n"
64
      print h[p], " ", @projects[p].name, " [", p, "]\n"
62 65
    end
63 66
  end
64 67
end
......
69 72

  
70 73
  # most annoyingly, the parser can't handle the comma-separated list
71 74
  # in X-Forwarded-For where it has more than one element. If it has
72
  # failed, remove any IP addresses with trailing commas and try again
75
  # failed, remove any IP addresses or the word "unknown" with
76
  # trailing commas and try again
73 77
  if not record
74
    filtered = line.gsub(/([0-9]+\.){3}[0-9]+,\s*/, "")
78
    filtered = line.gsub(/(unknown|([0-9]+\.){3}[0-9]+),\s*/, "")
75 79
    record = parser.parse(filtered)
76 80
  end
77 81

  

Also available in: Unified diff