bind_log_analyzer 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -136,4 +136,18 @@ On a 1.6 Ghz Intel Core i5 with SSD SATA2 disk, using Ruby-1.9.3-p125 and MySQL
136
136
  Analyzed 319758 lines and correctly stored 319758 logs
137
137
  bind_log_analyzer -f query.log -c database.yml 322,44s user 22,90s system 76% cpu 7:33,17 total
138
138
 
139
- which is equivalent to ±706 query/sec.
139
+ which is equivalent to ±706 query/sec.
140
+
141
+ ## Changelog
142
+
143
+ ### 0.2.1
144
+
145
+ If the **-c, --config CONFIG** parameter is not specified, it tries to use a *database.yml* file in the directory from where the gem was launched
146
+
147
+ ### 0.2.0
148
+
149
+ First version including the web interface
150
+
151
+ ### 0.1.0
152
+
153
+ First stable version
@@ -0,0 +1,7 @@
1
+ database:
2
+ adapter: mysql2
3
+ database: bindloganalyzer
4
+ host: localhost
5
+ port: 3306
6
+ username: root
7
+ password:
@@ -141,7 +141,7 @@ supported by ActiveRecord.</p>
141
141
 
142
142
  </div>
143
143
  </dt>
144
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.2.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
144
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.2.1</span><span class='tstring_end'>&quot;</span></span></pre></dd>
145
145
 
146
146
  </dl>
147
147
 
@@ -157,7 +157,7 @@ supported by ActiveRecord.</p>
157
157
  </div>
158
158
 
159
159
  <div id="footer">
160
- Generated on Thu Apr 5 16:11:31 2012 by
160
+ Generated on Thu Apr 5 16:40:26 2012 by
161
161
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
162
162
  0.7.5 (ruby-1.9.3).
163
163
  </div>
@@ -879,7 +879,7 @@ successful</p>
879
879
  </div>
880
880
 
881
881
  <div id="footer">
882
- Generated on Thu Apr 5 16:11:31 2012 by
882
+ Generated on Thu Apr 5 16:40:26 2012 by
883
883
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
884
884
  0.7.5 (ruby-1.9.3).
885
885
  </div>
@@ -599,7 +599,7 @@ informations</p>
599
599
  <span class='kw'>end</span>
600
600
  <span class='kw'>else</span>
601
601
  <span class='comment'># Tries to find the yaml file or prints an error
602
- </span> <span class='id identifier rubyid_filename'>filename</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>database.yml</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
602
+ </span> <span class='id identifier rubyid_filename'>filename</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>./database.yml</span><span class='tstring_end'>'</span></span>
603
603
  <span class='kw'>if</span> <span class='const'>FileTest</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
604
604
  <span class='ivar'>@database_params</span> <span class='op'>=</span> <span class='const'>YAML</span><span class='op'>::</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>database</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
605
605
  <span class='kw'>else</span>
@@ -874,7 +874,7 @@ if requested, loads the Log ActiveRecord model and setups the logger.</p>
874
874
  </div>
875
875
 
876
876
  <div id="footer">
877
- Generated on Thu Apr 5 16:11:31 2012 by
877
+ Generated on Thu Apr 5 16:40:26 2012 by
878
878
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
879
879
  0.7.5 (ruby-1.9.3).
880
880
  </div>
@@ -118,7 +118,7 @@
118
118
  </div>
119
119
 
120
120
  <div id="footer">
121
- Generated on Thu Apr 5 16:11:31 2012 by
121
+ Generated on Thu Apr 5 16:40:26 2012 by
122
122
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
123
123
  0.7.5 (ruby-1.9.3).
124
124
  </div>
@@ -118,7 +118,7 @@
118
118
  </div>
119
119
 
120
120
  <div id="footer">
121
- Generated on Thu Apr 5 16:11:31 2012 by
121
+ Generated on Thu Apr 5 16:40:26 2012 by
122
122
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
123
123
  0.7.5 (ruby-1.9.3).
124
124
  </div>
@@ -259,7 +259,7 @@
259
259
  </div>
260
260
 
261
261
  <div id="footer">
262
- Generated on Thu Apr 5 16:11:31 2012 by
262
+ Generated on Thu Apr 5 16:40:26 2012 by
263
263
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
264
264
  0.7.5 (ruby-1.9.3).
265
265
  </div>
@@ -162,7 +162,7 @@
162
162
  </div>
163
163
 
164
164
  <div id="footer">
165
- Generated on Thu Apr 5 16:11:31 2012 by
165
+ Generated on Thu Apr 5 16:40:26 2012 by
166
166
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
167
167
  0.7.5 (ruby-1.9.3).
168
168
  </div>
@@ -56,7 +56,10 @@
56
56
 
57
57
  <div id="content"><div id='filecontents'><h1>Bind Log Analyzer</h1>
58
58
 
59
- <p>Simple analysis and SQL storage for Bind DNS server&#39;s logs</p>
59
+ <p>Simple analysis and SQL storage for Bind DNS server&#39;s logs.
60
+ The gem includes a web interface to analyze the data collected from the analyzed logs.</p>
61
+
62
+ <p><img src="http://f.cl.ly/items/0A1A173R3b012R1V2x2b/bind_log_analyzer_screenshot_1.jpg" alt="Bind Log Analyzer web interface"></p>
60
63
 
61
64
  <h2>Requirements</h2>
62
65
 
@@ -123,8 +126,9 @@ This is the MySQL CREATE TABLE syntax:</p>
123
126
 
124
127
  <pre class="code ruby"><code>-h, --help Display this screen
125
128
  -v, --verbose LEVEL Enables verbose output. Use level 1 for WARN, 2 for INFO and 3 for DEBUG
129
+ -w, --webserver [HTTP_PORT] Launches the Sinatra web server on specified port, or 4567 if omitted
126
130
  -s, --setup Creates the needed tables in the database.
127
- -f, --file FILE Indicates the log file to parse. It's mandatory.
131
+ -f, --file FILE Indicates the log file to parse. It's mandatory if you don't specify the --webserver option.
128
132
  -c, --config CONFIG A yaml file containing the database configurations under the &quot;database&quot; entry
129
133
  -a, --adapter ADAPTER The database name to save the logs
130
134
  -d, --database DATABASE The database name to save the logs
@@ -134,8 +138,6 @@ This is the MySQL CREATE TABLE syntax:</p>
134
138
  -p, --password PASSWORD The password of the user
135
139
  </code></pre>
136
140
 
137
- <p>There&#39;s only one mandatory argument which is <strong>--file FILE</strong>. With this flag you pass the Bind log file to analyze to <em>BindLogAnalyzer</em>.</p>
138
-
139
141
  <p>The first time you launch <em>BindLogAnalyzer</em> you can use the <strong>-s|--setup</strong> flag to make it create the table (using ActiveRecord::Migration).
140
142
  The database credentials can be provided using the needed flags or creating a YAML file containing all the informations under the <strong>database</strong> key. This is an example:</p>
141
143
 
@@ -148,6 +150,13 @@ The database credentials can be provided using the needed flags or creating a YA
148
150
  password:
149
151
  </code></pre>
150
152
 
153
+ <p>There are two usage of the gem:</p>
154
+
155
+ <ul>
156
+ <li>Use <strong>--file FILE</strong> flag to pass to <em>BindLogAnalyzer</em> the file to analyze.</li>
157
+ <li>Use <strong>-w, --webserver [HTTP_PORT]</strong> to start the Sinatra webserver and watch the stats on the collected data.</li>
158
+ </ul>
159
+
151
160
  <h2>Automatization</h2>
152
161
 
153
162
  <p>A good way to use this script is to let it be launched by <strong>logrotate</strong> so create the <em>/etc/logrotate.d/bind</em> file with this content:</p>
@@ -198,15 +207,23 @@ bind_log_analyzer -f query.log -c database.yml 322,44s user 22,90s system 76% c
198
207
 
199
208
  <p>which is equivalent to ±706 query/sec.</p>
200
209
 
201
- <h2>To do</h2>
210
+ <h2>Changelog</h2>
202
211
 
203
- <ul>
204
- <li>Add a web interface to show the queries (with awesome graphs, obviously :)</li>
205
- </ul>
212
+ <h3>0.2.1</h3>
213
+
214
+ <p>If the <strong>-c, --config CONFIG</strong> parameter is not specified, it tries to use a <em>database.yml</em> file in the directory from where the gem was launched</p>
215
+
216
+ <h3>0.2.0</h3>
217
+
218
+ <p>First version including the web interface</p>
219
+
220
+ <h3>0.1.0</h3>
221
+
222
+ <p>First stable version</p>
206
223
  </div></div>
207
224
 
208
225
  <div id="footer">
209
- Generated on Thu Apr 5 16:11:31 2012 by
226
+ Generated on Thu Apr 5 16:40:26 2012 by
210
227
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
211
228
  0.7.5 (ruby-1.9.3).
212
229
  </div>
@@ -56,7 +56,10 @@
56
56
 
57
57
  <div id="content"><div id='filecontents'><h1>Bind Log Analyzer</h1>
58
58
 
59
- <p>Simple analysis and SQL storage for Bind DNS server&#39;s logs</p>
59
+ <p>Simple analysis and SQL storage for Bind DNS server&#39;s logs.
60
+ The gem includes a web interface to analyze the data collected from the analyzed logs.</p>
61
+
62
+ <p><img src="http://f.cl.ly/items/0A1A173R3b012R1V2x2b/bind_log_analyzer_screenshot_1.jpg" alt="Bind Log Analyzer web interface"></p>
60
63
 
61
64
  <h2>Requirements</h2>
62
65
 
@@ -123,8 +126,9 @@ This is the MySQL CREATE TABLE syntax:</p>
123
126
 
124
127
  <pre class="code ruby"><code>-h, --help Display this screen
125
128
  -v, --verbose LEVEL Enables verbose output. Use level 1 for WARN, 2 for INFO and 3 for DEBUG
129
+ -w, --webserver [HTTP_PORT] Launches the Sinatra web server on specified port, or 4567 if omitted
126
130
  -s, --setup Creates the needed tables in the database.
127
- -f, --file FILE Indicates the log file to parse. It's mandatory.
131
+ -f, --file FILE Indicates the log file to parse. It's mandatory if you don't specify the --webserver option.
128
132
  -c, --config CONFIG A yaml file containing the database configurations under the &quot;database&quot; entry
129
133
  -a, --adapter ADAPTER The database name to save the logs
130
134
  -d, --database DATABASE The database name to save the logs
@@ -134,8 +138,6 @@ This is the MySQL CREATE TABLE syntax:</p>
134
138
  -p, --password PASSWORD The password of the user
135
139
  </code></pre>
136
140
 
137
- <p>There&#39;s only one mandatory argument which is <strong>--file FILE</strong>. With this flag you pass the Bind log file to analyze to <em>BindLogAnalyzer</em>.</p>
138
-
139
141
  <p>The first time you launch <em>BindLogAnalyzer</em> you can use the <strong>-s|--setup</strong> flag to make it create the table (using ActiveRecord::Migration).
140
142
  The database credentials can be provided using the needed flags or creating a YAML file containing all the informations under the <strong>database</strong> key. This is an example:</p>
141
143
 
@@ -148,6 +150,13 @@ The database credentials can be provided using the needed flags or creating a YA
148
150
  password:
149
151
  </code></pre>
150
152
 
153
+ <p>There are two usage of the gem:</p>
154
+
155
+ <ul>
156
+ <li>Use <strong>--file FILE</strong> flag to pass to <em>BindLogAnalyzer</em> the file to analyze.</li>
157
+ <li>Use <strong>-w, --webserver [HTTP_PORT]</strong> to start the Sinatra webserver and watch the stats on the collected data.</li>
158
+ </ul>
159
+
151
160
  <h2>Automatization</h2>
152
161
 
153
162
  <p>A good way to use this script is to let it be launched by <strong>logrotate</strong> so create the <em>/etc/logrotate.d/bind</em> file with this content:</p>
@@ -198,15 +207,23 @@ bind_log_analyzer -f query.log -c database.yml 322,44s user 22,90s system 76% c
198
207
 
199
208
  <p>which is equivalent to ±706 query/sec.</p>
200
209
 
201
- <h2>To do</h2>
210
+ <h2>Changelog</h2>
202
211
 
203
- <ul>
204
- <li>Add a web interface to show the queries (with awesome graphs, obviously :)</li>
205
- </ul>
212
+ <h3>0.2.1</h3>
213
+
214
+ <p>If the <strong>-c, --config CONFIG</strong> parameter is not specified, it tries to use a <em>database.yml</em> file in the directory from where the gem was launched</p>
215
+
216
+ <h3>0.2.0</h3>
217
+
218
+ <p>First version including the web interface</p>
219
+
220
+ <h3>0.1.0</h3>
221
+
222
+ <p>First stable version</p>
206
223
  </div></div>
207
224
 
208
225
  <div id="footer">
209
- Generated on Thu Apr 5 16:11:31 2012 by
226
+ Generated on Thu Apr 5 16:40:26 2012 by
210
227
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
211
228
  0.7.5 (ruby-1.9.3).
212
229
  </div>
@@ -98,7 +98,7 @@
98
98
  </div>
99
99
 
100
100
  <div id="footer">
101
- Generated on Thu Apr 5 16:11:31 2012 by
101
+ Generated on Thu Apr 5 16:40:26 2012 by
102
102
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
103
103
  0.7.5 (ruby-1.9.3).
104
104
  </div>
@@ -72,7 +72,7 @@ module BindLogAnalyzer
72
72
  end
73
73
  else
74
74
  # Tries to find the yaml file or prints an error
75
- filename = File.join(File.dirname(__FILE__), 'database.yml')
75
+ filename = './database.yml'
76
76
  if FileTest.exists?(filename)
77
77
  @database_params = YAML::load(File.open(filename))['database']
78
78
  else
@@ -1,4 +1,4 @@
1
1
  module BindLogAnalyzer
2
2
  # @return [String] The version of the gem
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bind_log_analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &13957920 !ruby/object:Gem::Requirement
16
+ requirement: &20014180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *13957920
24
+ version_requirements: *20014180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &13957420 !ruby/object:Gem::Requirement
27
+ requirement: &20013680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *13957420
35
+ version_requirements: *20013680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sinatra
38
- requirement: &14057240 !ruby/object:Gem::Requirement
38
+ requirement: &20113540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *14057240
46
+ version_requirements: *20113540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: haml
49
- requirement: &14056740 !ruby/object:Gem::Requirement
49
+ requirement: &20113000 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *14056740
57
+ version_requirements: *20113000
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &14056200 !ruby/object:Gem::Requirement
60
+ requirement: &20112500 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *14056200
68
+ version_requirements: *20112500
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
- requirement: &14055700 !ruby/object:Gem::Requirement
71
+ requirement: &20112000 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *14055700
79
+ version_requirements: *20112000
80
80
  description: BindLogAnalyzer analyzes a Bind query log file and stores it's data into
81
81
  a SQL database (ActiveRecord is used for this feature)
82
82
  email:
@@ -92,6 +92,7 @@ files:
92
92
  - Rakefile
93
93
  - bin/bind_log_analyzer
94
94
  - bind_log_analyzer.gemspec
95
+ - database.yml
95
96
  - db/migrate/20120329151738_create_logs.rb
96
97
  - doc/BindLogAnalyzer.html
97
98
  - doc/BindLogAnalyzer/Base.html