Last active
September 24, 2015 20:12
-
-
Save bencaron/61e090843d5cdde9c882 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
# | |
# Extract URI from an Apache log and generate a | |
# full URL file (like for exemple load-testing with Siege) | |
# | |
# Usage: | |
# extract-url.rb your.domain.name.com logfile [logfile logfile logfile] | |
# | |
targetdomain = ARGV.shift | |
ARGV.each do |logfile| | |
File.foreach(logfile, "rt") do |line| | |
matches = /^.*GET\s([^\s]*)\sHTTP\S*\s(\d+)/.match(line) | |
unless matches == nil | |
puts 'http://'+ targetdomain + matches[1] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment