bind_log_analyzer 0.1.1 → 0.2.0
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 +12 -9
- data/bin/bind_log_analyzer +30 -6
- data/bind_log_analyzer.gemspec +3 -0
- data/doc/BindLogAnalyzer.html +4 -4
- data/doc/BindLogAnalyzer/Base.html +65 -193
- data/doc/BindLogAnalyzer/Connector.html +380 -55
- data/doc/BindLogAnalyzer/DatabaseConfsNotValid.html +1 -1
- data/doc/BindLogAnalyzer/WebServer.html +127 -0
- data/doc/Log.html +142 -1
- data/doc/_index.html +16 -1
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +35 -3
- data/doc/top-level-namespace.html +1 -1
- data/lib/bind_log_analyzer.rb +1 -0
- data/lib/bind_log_analyzer/base.rb +3 -27
- data/lib/bind_log_analyzer/connector.rb +58 -16
- data/lib/bind_log_analyzer/version.rb +1 -1
- data/lib/bind_log_analyzer/web_server.rb +45 -0
- data/lib/models/log.rb +10 -0
- data/resources/assets/images/glyphicons-halflings-white.png +0 -0
- data/resources/assets/images/glyphicons-halflings.png +0 -0
- data/resources/assets/javascripts/backbone-min.js +38 -0
- data/resources/assets/javascripts/bootstrap.min.js +6 -0
- data/resources/assets/stylesheets/bootstrap-responsive.min.css +12 -0
- data/resources/assets/stylesheets/bootstrap.min.css +689 -0
- data/resources/assets/stylesheets/main.css +4 -0
- data/resources/views/index.haml +16 -0
- data/resources/views/last_queries.haml +16 -0
- data/resources/views/layout.haml +14 -0
- data/resources/views/navbar.haml +12 -0
- data/resources/views/top_clients.haml +10 -0
- data/resources/views/top_queries.haml +10 -0
- metadata +56 -8
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Bind Log Analyzer
|
2
2
|
|
3
|
-
Simple analysis and SQL storage for Bind DNS server's logs
|
3
|
+
Simple analysis and SQL storage for Bind DNS server's logs.
|
4
|
+
The gem includes a web interface to analyze the data collected from the analyzed logs.
|
5
|
+
|
6
|
+

|
4
7
|
|
5
8
|
## Requirements
|
6
9
|
|
@@ -61,8 +64,9 @@ Use the provided --help to get various options available. This is the default he
|
|
61
64
|
|
62
65
|
-h, --help Display this screen
|
63
66
|
-v, --verbose LEVEL Enables verbose output. Use level 1 for WARN, 2 for INFO and 3 for DEBUG
|
67
|
+
-w, --webserver [HTTP_PORT] Launches the Sinatra web server on specified port, or 4567 if omitted
|
64
68
|
-s, --setup Creates the needed tables in the database.
|
65
|
-
-f, --file FILE Indicates the log file to parse. It's mandatory.
|
69
|
+
-f, --file FILE Indicates the log file to parse. It's mandatory if you don't specify the --webserver option.
|
66
70
|
-c, --config CONFIG A yaml file containing the database configurations under the "database" entry
|
67
71
|
-a, --adapter ADAPTER The database name to save the logs
|
68
72
|
-d, --database DATABASE The database name to save the logs
|
@@ -71,8 +75,6 @@ Use the provided --help to get various options available. This is the default he
|
|
71
75
|
-u, --user USER The username to be used to connect to the database
|
72
76
|
-p, --password PASSWORD The password of the user
|
73
77
|
|
74
|
-
There's only one mandatory argument which is **--file FILE**. With this flag you pass the Bind log file to analyze to *BindLogAnalyzer*.
|
75
|
-
|
76
78
|
The first time you launch *BindLogAnalyzer* you can use the **-s|--setup** flag to make it create the table (using ActiveRecord::Migration).
|
77
79
|
The database credentials can be provided using the needed flags or creating a YAML file containing all the informations under the **database** key. This is an example:
|
78
80
|
|
@@ -84,6 +86,11 @@ The database credentials can be provided using the needed flags or creating a YA
|
|
84
86
|
username: root
|
85
87
|
password:
|
86
88
|
|
89
|
+
There are two usage of the gem:
|
90
|
+
|
91
|
+
* Use **--file FILE** flag to pass to *BindLogAnalyzer* the file to analyze.
|
92
|
+
* Use **-w, --webserver [HTTP_PORT]** to start the Sinatra webserver and watch the stats on the collected data.
|
93
|
+
|
87
94
|
## Automatization
|
88
95
|
|
89
96
|
A good way to use this script is to let it be launched by **logrotate** so create the _/etc/logrotate.d/bind_ file with this content:
|
@@ -129,8 +136,4 @@ On a 1.6 Ghz Intel Core i5 with SSD SATA2 disk, using Ruby-1.9.3-p125 and MySQL
|
|
129
136
|
Analyzed 319758 lines and correctly stored 319758 logs
|
130
137
|
bind_log_analyzer -f query.log -c database.yml 322,44s user 22,90s system 76% cpu 7:33,17 total
|
131
138
|
|
132
|
-
which is equivalent to ±706 query/sec.
|
133
|
-
|
134
|
-
## To do
|
135
|
-
|
136
|
-
- Add a web interface to show the queries (with awesome graphs, obviously :)
|
139
|
+
which is equivalent to ±706 query/sec.
|
data/bin/bind_log_analyzer
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require "bind_log_analyzer"
|
4
|
-
require
|
4
|
+
require "optparse"
|
5
5
|
|
6
6
|
@filename = nil
|
7
7
|
@log_level = 0
|
8
8
|
@database_confs = nil
|
9
9
|
@setup_database = false
|
10
|
+
@webserver = false
|
11
|
+
@webserver_port = nil
|
10
12
|
@db_yaml = nil
|
11
13
|
@db_adapter = 'mysql2'
|
12
14
|
@db_host = nil
|
@@ -18,7 +20,7 @@ require 'optparse'
|
|
18
20
|
optparse = OptionParser.new do |opts|
|
19
21
|
# Set a banner, displayed at the top
|
20
22
|
# of the help screen.
|
21
|
-
opts.banner = "Usage: ./#{File.basename(__FILE__)} (--file|-f FILENAME [--setup|-s] [--verbose|-v (1|2|3)] [--database|-d database_name] [--config|-c database_yaml_configurations] [--host|-H database_hostname] [--port|-p database_port] [--user|-u database_username] [--password|-p database_password] | --help|-h)"
|
23
|
+
opts.banner = "Usage: ./#{File.basename(__FILE__)} (--file|-f FILENAME [--setup|-s] [--verbose|-v (1|2|3)] [--database|-d database_name] [--config|-c database_yaml_configurations] [--host|-H database_hostname] [--port|-p database_port] [--user|-u database_username] [--password|-p database_password] [-w|--webserver] | --help|-h)"
|
22
24
|
|
23
25
|
# This displays the help screen
|
24
26
|
opts.on( '-h', '--help', 'Display this screen' ) do
|
@@ -37,11 +39,16 @@ optparse = OptionParser.new do |opts|
|
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
42
|
+
opts.on( '-w', '--webserver [HTTP_PORT]', "Launches the Sinatra web server on specified port, or 4567 if omitted" ) do |opt|
|
43
|
+
@webserver = true
|
44
|
+
@webserver_port = opt if opt != true
|
45
|
+
end
|
46
|
+
|
40
47
|
opts.on( '-s', '--setup', "Creates the needed tables in the database." ) do |opt|
|
41
48
|
@setup_database = true
|
42
49
|
end
|
43
50
|
|
44
|
-
opts.on( '-f', '--file FILE', "Indicates the log file to parse. It's mandatory." ) do |opt|
|
51
|
+
opts.on( '-f', '--file FILE', "Indicates the log file to parse. It's mandatory if you don't specify the --webserver option." ) do |opt|
|
45
52
|
@filename = opt
|
46
53
|
end
|
47
54
|
|
@@ -89,9 +96,26 @@ elsif @db_username || @db_password || @db_host || @db_port || @db_database
|
|
89
96
|
}
|
90
97
|
end
|
91
98
|
|
92
|
-
if @
|
93
|
-
|
94
|
-
|
99
|
+
if @webserver
|
100
|
+
puts <<EOF
|
101
|
+
#**********************************#
|
102
|
+
# #
|
103
|
+
# Running Sinatra-based web server #
|
104
|
+
# #
|
105
|
+
# Use CTRL+C to stop the server #
|
106
|
+
# #
|
107
|
+
#**********************************#
|
108
|
+
EOF
|
109
|
+
@log_level = 1 if @log_level == 0
|
110
|
+
BindLogAnalyzer::Connector.establish_connection(@database_confs, @log_level)
|
111
|
+
if @webserver_port
|
112
|
+
BindLogAnalyzer::WebServer.run!({ port: @webserver_port.to_i})
|
113
|
+
else
|
114
|
+
BindLogAnalyzer::WebServer.run!
|
115
|
+
end
|
116
|
+
elsif @filename
|
117
|
+
base = BindLogAnalyzer::Base.new(@database_confs, @filename, @setup_database, @log_level)
|
118
|
+
base.analyze
|
95
119
|
else
|
96
120
|
puts optparse.banner
|
97
121
|
exit -1
|
data/bind_log_analyzer.gemspec
CHANGED
@@ -19,6 +19,9 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
21
|
s.add_dependency "activerecord"
|
22
|
+
s.add_dependency "json"
|
23
|
+
s.add_dependency "sinatra"
|
24
|
+
s.add_dependency "haml"
|
22
25
|
s.add_development_dependency "rspec"
|
23
26
|
s.add_development_dependency "simplecov"
|
24
27
|
end
|
data/doc/BindLogAnalyzer.html
CHANGED
@@ -73,7 +73,7 @@
|
|
73
73
|
|
74
74
|
<dt class="r1 last">Defined in:</dt>
|
75
75
|
<dd class="r1 last">lib/bind_log_analyzer.rb<span class="defines">,<br />
|
76
|
-
lib/bind_log_analyzer/base.rb,<br /> lib/bind_log_analyzer/version.rb,<br /> lib/bind_log_analyzer/connector.rb,<br /> lib/bind_log_analyzer/exceptions.rb</span>
|
76
|
+
lib/bind_log_analyzer/base.rb,<br /> lib/bind_log_analyzer/version.rb,<br /> lib/bind_log_analyzer/connector.rb,<br /> lib/bind_log_analyzer/web_server.rb,<br /> lib/bind_log_analyzer/exceptions.rb</span>
|
77
77
|
</dd>
|
78
78
|
|
79
79
|
</dl>
|
@@ -100,7 +100,7 @@ supported by ActiveRecord.</p>
|
|
100
100
|
|
101
101
|
|
102
102
|
|
103
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="BindLogAnalyzer/Base.html" title="BindLogAnalyzer::Base (class)">Base</a></span>, <span class='object_link'><a href="BindLogAnalyzer/DatabaseConfsNotValid.html" title="BindLogAnalyzer::DatabaseConfsNotValid (class)">DatabaseConfsNotValid</a></span>
|
103
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="BindLogAnalyzer/Base.html" title="BindLogAnalyzer::Base (class)">Base</a></span>, <span class='object_link'><a href="BindLogAnalyzer/DatabaseConfsNotValid.html" title="BindLogAnalyzer::DatabaseConfsNotValid (class)">DatabaseConfsNotValid</a></span>, <span class='object_link'><a href="BindLogAnalyzer/WebServer.html" title="BindLogAnalyzer::WebServer (class)">WebServer</a></span>
|
104
104
|
|
105
105
|
|
106
106
|
</p>
|
@@ -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'>"</span><span class='tstring_content'>0.
|
144
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.2.0</span><span class='tstring_end'>"</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
|
160
|
+
Generated on Thu Apr 5 16:11:31 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>
|
@@ -114,32 +114,6 @@
|
|
114
114
|
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
115
115
|
<ul class="summary">
|
116
116
|
|
117
|
-
<li class="public ">
|
118
|
-
<span class="summary_signature">
|
119
|
-
|
120
|
-
<a href="#database_confs-instance_method" title="#database_confs (instance method)">- (Hash) <strong>database_confs</strong> </a>
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
</span>
|
125
|
-
|
126
|
-
|
127
|
-
<span class="note title readonly">readonly</span>
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
<span class="summary_desc"><div class='inline'>
|
137
|
-
<p>The hash containing the database params and credentials.</p>
|
138
|
-
</div></span>
|
139
|
-
|
140
|
-
</li>
|
141
|
-
|
142
|
-
|
143
117
|
<li class="public ">
|
144
118
|
<span class="summary_signature">
|
145
119
|
|
@@ -205,7 +179,7 @@
|
|
205
179
|
<li class="public ">
|
206
180
|
<span class="summary_signature">
|
207
181
|
|
208
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Base) <strong>initialize</strong>(
|
182
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Base) <strong>initialize</strong>(database_params = nil, logfile = nil, setup_database = false, log_level = 0) </a>
|
209
183
|
|
210
184
|
|
211
185
|
|
@@ -332,14 +306,14 @@ setup of the database.</p>
|
|
332
306
|
|
333
307
|
|
334
308
|
<h3 class="inherited">Methods included from <span class='object_link'><a href="Connector.html" title="BindLogAnalyzer::Connector (module)">Connector</a></span></h3>
|
335
|
-
<p class="inherited"><span class='object_link'><a href="Connector.html#connect-
|
309
|
+
<p class="inherited"><span class='object_link'><a href="Connector.html#connect-class_method" title="BindLogAnalyzer::Connector.connect (method)">connect</a></span>, <span class='object_link'><a href="Connector.html#connected%3F-instance_method" title="BindLogAnalyzer::Connector#connected? (method)">#connected?</a></span>, <span class='object_link'><a href="Connector.html#establish_connection-class_method" title="BindLogAnalyzer::Connector.establish_connection (method)">establish_connection</a></span>, <span class='object_link'><a href="Connector.html#load_environment-instance_method" title="BindLogAnalyzer::Connector#load_environment (method)">#load_environment</a></span>, <span class='object_link'><a href="Connector.html#migrate_tables-instance_method" title="BindLogAnalyzer::Connector#migrate_tables (method)">#migrate_tables</a></span>, <span class='object_link'><a href="Connector.html#set_log_level-class_method" title="BindLogAnalyzer::Connector.set_log_level (method)">set_log_level</a></span>, <span class='object_link'><a href="Connector.html#setup_db-instance_method" title="BindLogAnalyzer::Connector#setup_db (method)">#setup_db</a></span>, <span class='object_link'><a href="Connector.html#setup_db_confs-class_method" title="BindLogAnalyzer::Connector.setup_db_confs (method)">setup_db_confs</a></span></p>
|
336
310
|
<div id="constructor_details" class="method_details_list">
|
337
311
|
<h2>Constructor Details</h2>
|
338
312
|
|
339
313
|
<div class="method_details first">
|
340
314
|
<p class="signature first" id="initialize-instance_method">
|
341
315
|
|
342
|
-
- (<tt><span class='object_link'><a href="" title="BindLogAnalyzer::Base (class)">Base</a></span></tt>) <strong>initialize</strong>(
|
316
|
+
- (<tt><span class='object_link'><a href="" title="BindLogAnalyzer::Base (class)">Base</a></span></tt>) <strong>initialize</strong>(database_params = nil, logfile = nil, setup_database = false, log_level = 0)
|
343
317
|
|
344
318
|
|
345
319
|
|
@@ -358,7 +332,7 @@ setup of the database</p>
|
|
358
332
|
|
359
333
|
<li>
|
360
334
|
|
361
|
-
<span class='name'>
|
335
|
+
<span class='name'>database_params</span>
|
362
336
|
|
363
337
|
|
364
338
|
<span class='type'>(<tt>Hash</tt>, <tt>String</tt>)</span>
|
@@ -438,61 +412,19 @@ informations</p>
|
|
438
412
|
<pre class="lines">
|
439
413
|
|
440
414
|
|
415
|
+
19
|
416
|
+
20
|
417
|
+
21
|
441
418
|
22
|
442
|
-
23
|
443
|
-
24
|
444
|
-
25
|
445
|
-
26
|
446
|
-
27
|
447
|
-
28
|
448
|
-
29
|
449
|
-
30
|
450
|
-
31
|
451
|
-
32
|
452
|
-
33
|
453
|
-
34
|
454
|
-
35
|
455
|
-
36
|
456
|
-
37
|
457
|
-
38
|
458
|
-
39
|
459
|
-
40
|
460
|
-
41
|
461
|
-
42
|
462
|
-
43
|
463
|
-
44
|
464
|
-
45
|
465
|
-
46
|
466
|
-
47</pre>
|
419
|
+
23</pre>
|
467
420
|
</td>
|
468
421
|
<td>
|
469
|
-
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line
|
470
|
-
|
471
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier
|
472
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_database_confs'>database_confs</span>
|
473
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_database_confs'>database_confs</span><span class='period'>.</span><span class='id identifier rubyid_instance_of?'>instance_of?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
474
|
-
<span class='ivar'>@database_confs</span> <span class='op'>=</span> <span class='id identifier rubyid_database_confs'>database_confs</span>
|
475
|
-
<span class='kw'>else</span>
|
476
|
-
<span class='comment'># Load the yaml file
|
477
|
-
</span> <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_database_confs'>database_confs</span><span class='rparen'>)</span>
|
478
|
-
<span class='ivar'>@database_confs</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_database_confs'>database_confs</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>
|
479
|
-
<span class='kw'>else</span>
|
480
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>BindLogAnalyzer</span><span class='op'>::</span><span class='const'>DatabaseConfsNotValid</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The indicated YAML file doesn't exist or is invalid</span><span class='tstring_end'>"</span></span>
|
481
|
-
<span class='kw'>end</span>
|
482
|
-
<span class='kw'>end</span>
|
483
|
-
<span class='kw'>else</span>
|
484
|
-
<span class='comment'># Tries to find the yaml file or prints an error
|
485
|
-
</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>
|
486
|
-
<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>
|
487
|
-
<span class='ivar'>@database_confs</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>
|
488
|
-
<span class='kw'>else</span>
|
489
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>BindLogAnalyzer</span><span class='op'>::</span><span class='const'>DatabaseConfsNotValid</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Can't find valid database configurations</span><span class='tstring_end'>"</span></span>
|
490
|
-
<span class='kw'>end</span>
|
491
|
-
<span class='kw'>end</span>
|
492
|
-
|
422
|
+
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line 19</span>
|
423
|
+
|
424
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_database_params'>database_params</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_logfile'>logfile</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_setup_database'>setup_database</span> <span class='op'>=</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='id identifier rubyid_log_level'>log_level</span> <span class='op'>=</span> <span class='int'>0</span><span class='rparen'>)</span>
|
493
425
|
<span class='ivar'>@stored_queries</span> <span class='op'>=</span> <span class='int'>0</span>
|
494
426
|
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_logfile'>logfile</span> <span class='op'>=</span> <span class='id identifier rubyid_logfile'>logfile</span> <span class='kw'>if</span> <span class='id identifier rubyid_logfile'>logfile</span>
|
495
|
-
<span class='id identifier rubyid_setup_db'>setup_db</span><span class='lparen'>(</span><span class='
|
427
|
+
<span class='id identifier rubyid_setup_db'>setup_db</span><span class='lparen'>(</span><span class='id identifier rubyid_database_params'>database_params</span><span class='comma'>,</span> <span class='id identifier rubyid_setup_database'>setup_database</span><span class='comma'>,</span> <span class='id identifier rubyid_log_level'>log_level</span><span class='rparen'>)</span>
|
496
428
|
<span class='kw'>end</span></pre>
|
497
429
|
</td>
|
498
430
|
</tr>
|
@@ -505,70 +437,10 @@ informations</p>
|
|
505
437
|
<h2>Instance Attribute Details</h2>
|
506
438
|
|
507
439
|
|
508
|
-
<span id=""></span>
|
509
|
-
<span id="database_confs-instance_method"></span>
|
510
|
-
<div class="method_details first">
|
511
|
-
<p class="signature first" id="database_confs-instance_method">
|
512
|
-
|
513
|
-
- (<tt>Hash</tt>) <strong>database_confs</strong> <span class="extras">(readonly)</span>
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
</p><div class="docstring">
|
518
|
-
<div class="discussion">
|
519
|
-
|
520
|
-
<p>The hash containing the database params and credentials</p>
|
521
|
-
|
522
|
-
|
523
|
-
</div>
|
524
|
-
</div>
|
525
|
-
<div class="tags">
|
526
|
-
|
527
|
-
<h3>Returns:</h3>
|
528
|
-
<ul class="return">
|
529
|
-
|
530
|
-
<li>
|
531
|
-
|
532
|
-
|
533
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
—
|
538
|
-
<div class='inline'>
|
539
|
-
<p>The hash containing the database params and credentials</p>
|
540
|
-
</div>
|
541
|
-
|
542
|
-
</li>
|
543
|
-
|
544
|
-
</ul>
|
545
|
-
|
546
|
-
</div><table class="source_code">
|
547
|
-
<tr>
|
548
|
-
<td>
|
549
|
-
<pre class="lines">
|
550
|
-
|
551
|
-
|
552
|
-
15
|
553
|
-
16
|
554
|
-
17</pre>
|
555
|
-
</td>
|
556
|
-
<td>
|
557
|
-
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line 15</span>
|
558
|
-
|
559
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_database_confs'>database_confs</span>
|
560
|
-
<span class='ivar'>@database_confs</span>
|
561
|
-
<span class='kw'>end</span></pre>
|
562
|
-
</td>
|
563
|
-
</tr>
|
564
|
-
</table>
|
565
|
-
</div>
|
566
|
-
|
567
|
-
|
568
440
|
<span id=""></span>
|
569
441
|
<span id="log_filename-instance_method"></span>
|
570
|
-
<div class="method_details ">
|
571
|
-
<p class="signature " id="log_filename-instance_method">
|
442
|
+
<div class="method_details first">
|
443
|
+
<p class="signature first" id="log_filename-instance_method">
|
572
444
|
|
573
445
|
- (<tt>String</tt>) <strong>log_filename</strong> <span class="extras">(readonly)</span>
|
574
446
|
|
@@ -674,23 +546,23 @@ and passes wvery line to #parse_line and #store_query</p>
|
|
674
546
|
<pre class="lines">
|
675
547
|
|
676
548
|
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
549
|
+
72
|
550
|
+
73
|
551
|
+
74
|
552
|
+
75
|
553
|
+
76
|
554
|
+
77
|
555
|
+
78
|
556
|
+
79
|
557
|
+
80
|
558
|
+
81
|
559
|
+
82
|
560
|
+
83
|
561
|
+
84
|
562
|
+
85</pre>
|
691
563
|
</td>
|
692
564
|
<td>
|
693
|
-
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line
|
565
|
+
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line 72</span>
|
694
566
|
|
695
567
|
<span class='kw'>def</span> <span class='id identifier rubyid_analyze'>analyze</span>
|
696
568
|
<span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='ivar'>@log_filename</span>
|
@@ -753,12 +625,12 @@ and passes wvery line to #parse_line and #store_query</p>
|
|
753
625
|
<pre class="lines">
|
754
626
|
|
755
627
|
|
756
|
-
|
757
|
-
|
758
|
-
|
628
|
+
33
|
629
|
+
34
|
630
|
+
35</pre>
|
759
631
|
</td>
|
760
632
|
<td>
|
761
|
-
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line
|
633
|
+
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line 33</span>
|
762
634
|
|
763
635
|
<span class='kw'>def</span> <span class='id identifier rubyid_logfile'>logfile</span>
|
764
636
|
<span class='ivar'>@log_filename</span>
|
@@ -812,12 +684,12 @@ and passes wvery line to #parse_line and #store_query</p>
|
|
812
684
|
<pre class="lines">
|
813
685
|
|
814
686
|
|
815
|
-
|
816
|
-
|
817
|
-
|
687
|
+
27
|
688
|
+
28
|
689
|
+
29</pre>
|
818
690
|
</td>
|
819
691
|
<td>
|
820
|
-
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line
|
692
|
+
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line 27</span>
|
821
693
|
|
822
694
|
<span class='kw'>def</span> <span class='id identifier rubyid_logfile='>logfile=</span><span class='lparen'>(</span><span class='id identifier rubyid_logfile'>logfile</span><span class='rparen'>)</span>
|
823
695
|
<span class='ivar'>@log_filename</span> <span class='op'>=</span> <span class='id identifier rubyid_logfile'>logfile</span> <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_logfile'>logfile</span><span class='rparen'>)</span>
|
@@ -889,30 +761,30 @@ and passes wvery line to #parse_line and #store_query</p>
|
|
889
761
|
<pre class="lines">
|
890
762
|
|
891
763
|
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
764
|
+
40
|
765
|
+
41
|
766
|
+
42
|
767
|
+
43
|
768
|
+
44
|
769
|
+
45
|
770
|
+
46
|
771
|
+
47
|
772
|
+
48
|
773
|
+
49
|
774
|
+
50
|
775
|
+
51
|
776
|
+
52
|
777
|
+
53
|
778
|
+
54
|
779
|
+
55
|
780
|
+
56
|
781
|
+
57
|
782
|
+
58
|
783
|
+
59
|
784
|
+
60</pre>
|
913
785
|
</td>
|
914
786
|
<td>
|
915
|
-
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line
|
787
|
+
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line 40</span>
|
916
788
|
|
917
789
|
<span class='kw'>def</span> <span class='id identifier rubyid_parse_line'>parse_line</span><span class='lparen'>(</span><span class='id identifier rubyid_line'>line</span><span class='rparen'>)</span>
|
918
790
|
<span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
@@ -985,13 +857,13 @@ successful</p>
|
|
985
857
|
<pre class="lines">
|
986
858
|
|
987
859
|
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
860
|
+
64
|
861
|
+
65
|
862
|
+
66
|
863
|
+
67</pre>
|
992
864
|
</td>
|
993
865
|
<td>
|
994
|
-
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line
|
866
|
+
<pre class="code"><span class="info file"># File 'lib/bind_log_analyzer/base.rb', line 64</span>
|
995
867
|
|
996
868
|
<span class='kw'>def</span> <span class='id identifier rubyid_store_query'>store_query</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
997
869
|
<span class='id identifier rubyid_log'>log</span> <span class='op'>=</span> <span class='const'>Log</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
@@ -1007,7 +879,7 @@ successful</p>
|
|
1007
879
|
</div>
|
1008
880
|
|
1009
881
|
<div id="footer">
|
1010
|
-
Generated on
|
882
|
+
Generated on Thu Apr 5 16:11:31 2012 by
|
1011
883
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1012
884
|
0.7.5 (ruby-1.9.3).
|
1013
885
|
</div>
|