fluent-plugin-redis-slowlog 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/fluent-plugin-redis-slowlog.gemspec +1 -1
- data/lib/fluent/plugin/in_redis_slowlog.rb +12 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c12c14dacf1cc1157cb59c39c53c3101ec866ea
|
4
|
+
data.tar.gz: cf1cae8501dc56f8d93a0619cf0cd5b40e5ad637
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f68f511e3942067bcae7bbc3f183070b1201c35132a816e4a82e160f97e8ba33e21964079d63cc7f3ffcffb7ba7e2ea50911ae7297fa20f36e49d8ee777d003e
|
7
|
+
data.tar.gz: eaed5c6a16034ea7255b924822a2fbd08d499dea8e3f39326cea672d85c381ecab8e51b474c259c02688a1d709ec1dec1002355650580bfbf93cadfc24394a8f
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
<source>
|
10
10
|
type redis_slowlog
|
11
11
|
host [Redis Hostname]
|
12
|
-
port [Redis Port (default:
|
12
|
+
port [Redis Port (default: 6379)]
|
13
13
|
logsize [Redis Command(SLOWLOG get logsise) (default:128)]
|
14
14
|
interval [Redis Command(SLOWLOG get logsize) interval (default:10)]
|
15
15
|
tag redis.slowlog
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-redis-slowlog"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.2"
|
8
8
|
spec.authors = ["shingo suzuki"]
|
9
9
|
spec.email = ["s_suzuking@icloud.com"]
|
10
10
|
spec.description = "Redis slowlog input plugin for Fluent event collector"
|
@@ -14,10 +14,17 @@ class Fluent::Redis_SlowlogInput < Fluent::Input
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def configure(conf)
|
17
|
+
super
|
18
|
+
@log_id = 0
|
19
|
+
@get_interval = @interval
|
20
|
+
end
|
21
|
+
|
22
|
+
def start
|
17
23
|
super
|
18
24
|
@redis = Redis.new(
|
19
25
|
:host => @host,
|
20
|
-
:port => @port
|
26
|
+
:port => @port,
|
27
|
+
:thread_safe => true
|
21
28
|
)
|
22
29
|
pong = @redis.ping
|
23
30
|
begin
|
@@ -25,17 +32,12 @@ class Fluent::Redis_SlowlogInput < Fluent::Input
|
|
25
32
|
raise "fluent-plugin-redis-slowlog: cannot connect redis"
|
26
33
|
end
|
27
34
|
end
|
28
|
-
@log_id = 0
|
29
|
-
@get_interval = @interval
|
30
|
-
end
|
31
|
-
|
32
|
-
def start
|
33
|
-
super
|
34
35
|
@watcher = Thread.new(&method(:watch))
|
35
36
|
end
|
36
37
|
|
37
38
|
def shutdown
|
38
39
|
super
|
40
|
+
@redis.quit
|
39
41
|
end
|
40
42
|
|
41
43
|
private
|
@@ -51,11 +53,11 @@ class Fluent::Redis_SlowlogInput < Fluent::Input
|
|
51
53
|
slow_logs = @redis.slowlog('get', logsize)
|
52
54
|
|
53
55
|
log_id = slow_logs[0][0]
|
54
|
-
slow_logs.each do |log|
|
56
|
+
slow_logs.reverse.each do |log|
|
55
57
|
unless log[0] > last_id
|
56
|
-
|
58
|
+
next
|
57
59
|
end
|
58
|
-
log_hash = { id: log[0], timestamp: log[1], exec_time: log[2], command: log[3] }
|
60
|
+
log_hash = { id: log[0], timestamp: Time.at(log[1]), exec_time: log[2], command: log[3] }
|
59
61
|
Fluent::Engine.emit(tag, Time.now.to_i, log_hash)
|
60
62
|
end
|
61
63
|
return log_id
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-redis-slowlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shingo suzuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|