I generally use a tracking gif in the mass emails I send out to get a rough idea of the open rate. It's not a small task to open each log file, filter it and then count each occurance of the gif.
Hunter does this for you!
WARNING: Hunter has no tests. This was thrown together, so use with caution. Contributions are very welcome.
gem install hunter
Create a new hunt for the string you want to match:
hunt = Hunter::Hunt.new('/images/email/tracking.gif')
hunt.look_in('/var/log/httpd/access.log')
hunt.look_in_archived('/var/log/httpd/log_archive/access.log.1.gz')
hunt.look_through_archive('/var/log/httpd/log_archive')
hunt.look_through_archive('/var/log/httpd/log_archive', 'access.log')
- "Archived" means with the file extension
.gz
– no other compression formats are supported look_through_archive()
relies on your log appending a digit after the original filename and then compressing to.gz
- e.g.
access.log
becomesaccess.log.1.gz
- e.g.
- There are no tests