myslog 0.0.1 → 0.0.2
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 +37 -1
- data/lib/myslog.rb +0 -2
- data/myslog.gemspec +1 -1
- data/spec/myslog.rb +5 -5
- metadata +3 -3
data/README.md
CHANGED
@@ -1,4 +1,40 @@
|
|
1
1
|
myslog
|
2
2
|
======
|
3
3
|
|
4
|
-
MySQL slow query log parser
|
4
|
+
MySQL slow query log parser
|
5
|
+
|
6
|
+
Install
|
7
|
+
-------
|
8
|
+
|
9
|
+
```
|
10
|
+
gem install myslog
|
11
|
+
```
|
12
|
+
|
13
|
+
Usage
|
14
|
+
-----
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
myslog = MySlog.new
|
18
|
+
|
19
|
+
f = open("mysql-slow-query.log")
|
20
|
+
lines = f.read.split("\n")
|
21
|
+
f.close
|
22
|
+
|
23
|
+
logs = myslog.parse(lines)
|
24
|
+
```
|
25
|
+
|
26
|
+
`logs` is Array of Hash
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
log = logs.first
|
30
|
+
|
31
|
+
log[:date]
|
32
|
+
log[:user]
|
33
|
+
log[:host]
|
34
|
+
log[:host_ip]
|
35
|
+
log[:query_time]
|
36
|
+
log[:lock_time]
|
37
|
+
log[:rows_sent]
|
38
|
+
log[:rows_examined]
|
39
|
+
log[:sql]
|
40
|
+
```
|
data/lib/myslog.rb
CHANGED
data/myslog.gemspec
CHANGED
data/spec/myslog.rb
CHANGED
@@ -62,7 +62,7 @@ use webtie;
|
|
62
62
|
describe "#divide" do
|
63
63
|
|
64
64
|
it "should return Array of Array" do
|
65
|
-
results = @myslog.
|
65
|
+
results = @myslog.divide(@lines)
|
66
66
|
results.should be_an_instance_of Array
|
67
67
|
results.each do |result|
|
68
68
|
results.should be_an_instance_of Array
|
@@ -70,7 +70,7 @@ use webtie;
|
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should devide lines in set of records" do
|
73
|
-
results = @myslog.
|
73
|
+
results = @myslog.divide(@lines)
|
74
74
|
|
75
75
|
record = results[0]
|
76
76
|
record.size.should == 12
|
@@ -102,7 +102,7 @@ use webtie;
|
|
102
102
|
"# Time: 0 Lock_time: 0 Rows_sent: 1 Rows_examined: 1",
|
103
103
|
"use webtie;"
|
104
104
|
]
|
105
|
-
response = @myslog.
|
105
|
+
response = @myslog.parse_record(lines)
|
106
106
|
|
107
107
|
response.should be_an_instance_of Hash
|
108
108
|
%w[
|
@@ -128,7 +128,7 @@ use webtie;
|
|
128
128
|
"# Query_time: #{@query_time} Lock_time: #{@lock_time} Rows_sent: #{@rows_sent} Rows_examined: #{@rows_examined}",
|
129
129
|
@sql
|
130
130
|
]
|
131
|
-
@response = @myslog.
|
131
|
+
@response = @myslog.parse_record(@lines)
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should have expected values" do
|
@@ -161,7 +161,7 @@ use webtie;
|
|
161
161
|
"# Query_time: #{@query_time} Lock_time: #{@lock_time} Rows_sent: #{@rows_sent} Rows_examined: #{@rows_examined}",
|
162
162
|
@sql
|
163
163
|
]
|
164
|
-
@response = @myslog.
|
164
|
+
@response = @myslog.parse_record(@lines)
|
165
165
|
end
|
166
166
|
|
167
167
|
it "should have expected values" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myslog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-06-07 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70279301611840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70279301611840
|
25
25
|
description: MySQL slow query parser.
|
26
26
|
email:
|
27
27
|
- taka84u9@gmail.com
|