Getting the count of how many times a route has been hit
The Enumerable.group_by method is perfect for situations like this. The method takes the items in the enumerable, evaluates a block on them to yield a key, and inserts them into a hash under that key. Using this the code is very short:

puts(File.open('test.log').entries
    .group_by { |line| line.split(" ")[4] }
    .map { |k, v| "#{k},#{v.count}" })