Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 45 lines (24 sloc) 1.412 kb
cd8c5ba Add README
Gareth Rees authored
1 # Search for a pattern in your log files
2
79dc2d5 @garethrees Add Code Climate badge
authored
3 [![Code Climate](https://codeclimate.com/github/garethrees/hunter.png)](https://codeclimate.com/github/garethrees/hunter)
4
cd8c5ba Add README
Gareth Rees authored
5 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.
6
7 Hunter does this for you!
8
9 **WARNING:** Hunter has <u>**no tests**</u>. This was thrown together, so use with caution. Contributions are very welcome.
10
11 ## How to Use
12
13 ### Install
14
15 gem install hunter
16
17 ### Use
18
19 Create a new hunt for the string you want to match:
20
21 hunt = Hunter::Hunt.new('/images/email/tracking.gif')
22
23 #### Look in the current log
24
25 hunt.look_in('/var/log/httpd/access.log')
26
27 #### Look in an archived log
28
29 hunt.look_in_archived('/var/log/httpd/log_archive/access.log.1.gz')
30
31 #### Look through a folder of archived logs
32
33 hunt.look_through_archive('/var/log/httpd/log_archive')
34
35 #### Look through a folder of archived logs for a specific log type
36
37 hunt.look_through_archive('/var/log/httpd/log_archive', 'access.log')
38
39 ## Known Issues
40
41 * "Archived" means with the file extension `.gz` – no other compression formats are supported
42 * `look_through_archive()` relies on your log appending a digit after the original filename and then compressing to `.gz`
43 * e.g. `access.log` becomes `access.log.1.gz`
79dc2d5 @garethrees Add Code Climate badge
authored
44 * **There are no tests**
Something went wrong with that request. Please try again.