fluent-plugin-esslowquery 1.0.2 → 1.1.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.
- checksums.yaml +4 -4
- data/AUTHORS +6 -0
- data/CHANGELOG.md +7 -0
- data/README.md +19 -1
- data/fluent-plugin-esslowquery.gemspec +3 -3
- data/lib/fluent/plugin/parser_es_slow_indexing.rb +61 -0
- data/lib/fluent/plugin/parser_es_slow_query.rb +1 -1
- data/scripts/generate-authors.sh +11 -0
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c95c49ad0eda635329ee955882bf5a61d0d78616
|
4
|
+
data.tar.gz: e4ecd7cc218367315341925e41e25d12d37121e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26608ff0fef20868f43d039020df3d4101209832b0a5b9b7efa2b6e2d460458388c6d2bdc364e190e32ff7808bc668c772400dc4238c02c9d13a91ee1795c935
|
7
|
+
data.tar.gz: 9d922d61f8a44896debd55050b4d77f5541e81bfc8e5bde146300b626beca6d306899d1513f3fd9c09a4f5b0610d00c5b2612e7737ae9eb2860af47eab3483dc
|
data/AUTHORS
ADDED
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -26,12 +26,13 @@ Edit `/etc/td-agent/td-agent.conf` file.
|
|
26
26
|
path /var/log/elasticsearch/elasticsearch-{cluster-name}_index_indexing_slowlog.log
|
27
27
|
tag elasticsearch.{cluster-name}.indexing_slowlog_query
|
28
28
|
pos_file /var/run/td-agent/elasticsearch-indexing-slow.pos
|
29
|
-
format
|
29
|
+
format es_slow_indexing
|
30
30
|
</source>
|
31
31
|
```
|
32
32
|
|
33
33
|
##Expected record format
|
34
34
|
|
35
|
+
### Slow Query
|
35
36
|
```json
|
36
37
|
{
|
37
38
|
"extra_source": "{\"from\":0,\"size\":0}",
|
@@ -49,3 +50,20 @@ Edit `/etc/td-agent/td-agent.conf` file.
|
|
49
50
|
"types": "document"
|
50
51
|
}
|
51
52
|
```
|
53
|
+
### Slow Indexing
|
54
|
+
|
55
|
+
```json
|
56
|
+
{
|
57
|
+
"severity": "INFO ",
|
58
|
+
"source": "index.indexing.slowlog.index",
|
59
|
+
"node": "{cluster-name}-{node-id}",
|
60
|
+
"index": "comments",
|
61
|
+
"shard": 4,
|
62
|
+
"took": "891.4ms",
|
63
|
+
"took_millis": 891,
|
64
|
+
"type": "document",
|
65
|
+
"indexing_id": 120543866,
|
66
|
+
"routing": 2012927,
|
67
|
+
"source_body": "{}"
|
68
|
+
}
|
69
|
+
```
|
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.authors = ["Boguslaw Mista"]
|
3
3
|
gem.email = ["bodziomista@gmail.com"]
|
4
|
-
gem.description = "Fluent parser plugin for Elasticsearch slow query log
|
5
|
-
gem.summary = "Fluent parser plugin for Elasticsearch slow query log
|
4
|
+
gem.description = "Fluent parser plugin for Elasticsearch slow query and slow indexing log files."
|
5
|
+
gem.summary = "Fluent parser plugin for Elasticsearch slow query and slow indexing log files."
|
6
6
|
gem.homepage = "https://github.com/iaintshine/fluent-plugin-esslowquery"
|
7
7
|
gem.license = "MIT"
|
8
8
|
|
@@ -11,6 +11,6 @@ Gem::Specification.new do |gem|
|
|
11
11
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
12
12
|
gem.name = "fluent-plugin-esslowquery"
|
13
13
|
gem.require_paths = ["lib"]
|
14
|
-
gem.version = "1.0
|
14
|
+
gem.version = "1.1.0"
|
15
15
|
gem.add_dependency "fluentd", [">= 0.12.0", "< 2"]
|
16
16
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Fluent
|
2
|
+
class TextParser
|
3
|
+
class ElasticsearchSlowIndexingLogParser < Parser
|
4
|
+
REGEXP = /^\[(?<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})\]\[(?<severity>[a-zA-Z]+\s*)\]\[(?<source>\S+)\] \[(?<node>\S+)\] \[(?<index>\w+)\]\[(?<shard>\d+)\] took\[(?<took>.+)\], took_millis\[(?<took_millis>\d+)\], type\[(?<type>.+)\], id\[(?<indexing_id>.*)\], routing\[(?<routing>.*)\], source\[(?<source_body>.*)\]/
|
5
|
+
TIME_FORMAT = "%Y-%m-%d %H:%M:%S,%N"
|
6
|
+
|
7
|
+
Plugin.register_parser("es_slow_indexing", self)
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
super
|
11
|
+
@time_parser = TextParser::TimeParser.new(TIME_FORMAT)
|
12
|
+
@mutex = Mutex.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def patterns
|
16
|
+
{'format' => REGEXP, 'time_format' => TIME_FORMAT}
|
17
|
+
end
|
18
|
+
|
19
|
+
def parse(text)
|
20
|
+
m = REGEXP.match(text)
|
21
|
+
unless m
|
22
|
+
if block_given?
|
23
|
+
yield nil, nil
|
24
|
+
return
|
25
|
+
else
|
26
|
+
return nil, nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
shard = m['shard'].to_i
|
31
|
+
took_millis = m['took_millis'].to_i
|
32
|
+
indexing_id= m['indexing_id'].to_i
|
33
|
+
routing = m['routing'].to_i
|
34
|
+
|
35
|
+
time = m['time']
|
36
|
+
time = @mutex.synchronize { @time_parser.parse(time) }
|
37
|
+
|
38
|
+
record = {
|
39
|
+
'severity' => m['severity'],
|
40
|
+
'source' => m['source'],
|
41
|
+
'node' => m['node'],
|
42
|
+
'index' => m['index'],
|
43
|
+
'shard' => shard,
|
44
|
+
'took' => m['took'],
|
45
|
+
'took_millis' => took_millis,
|
46
|
+
'type' => m['type'],
|
47
|
+
'indexing_id' => indexing_id,
|
48
|
+
'routing' => routing,
|
49
|
+
'source_body' => m['source_body']
|
50
|
+
}
|
51
|
+
record["time"] = m['time'] if @keep_time_key
|
52
|
+
|
53
|
+
if block_given?
|
54
|
+
yield time, record
|
55
|
+
else
|
56
|
+
return time, record
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Fluent
|
2
|
-
class
|
2
|
+
class ElasticsearchSlowQueryLogParser < Parser
|
3
3
|
REGEXP = /^\[(?<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})\]\[(?<severity>[a-zA-Z]+\s*)\]\[(?<source>\S+)\] \[(?<node>\S+)\] \[(?<index>\w+)\]\[(?<shard>\d+)\] took\[(?<took>.+)\], took_millis\[(?<took_millis>\d+)\], types\[(?<types>.*)\], stats\[(?<stats>.*)\], search_type\[(?<search_type>.*)\], total_shards\[(?<total_shards>\d+)\], source\[(?<source_body>.*)\], extra_source\[(?<extra_source>.*)\]/
|
4
4
|
TIME_FORMAT = "%Y-%m-%d %H:%M:%S,%N"
|
5
5
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e
|
3
|
+
|
4
|
+
{
|
5
|
+
cat <<-'EOH'
|
6
|
+
# This file lists all individuals having contributed content to the repository.
|
7
|
+
# For how it is generated, see `script/generate-authors.sh`.
|
8
|
+
EOH
|
9
|
+
echo
|
10
|
+
git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf
|
11
|
+
} > AUTHORS
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-esslowquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boguslaw Mista
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -30,7 +30,8 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2'
|
33
|
-
description: Fluent parser plugin for Elasticsearch slow query log
|
33
|
+
description: Fluent parser plugin for Elasticsearch slow query and slow indexing log
|
34
|
+
files.
|
34
35
|
email:
|
35
36
|
- bodziomista@gmail.com
|
36
37
|
executables: []
|
@@ -38,11 +39,15 @@ extensions: []
|
|
38
39
|
extra_rdoc_files: []
|
39
40
|
files:
|
40
41
|
- ".gitignore"
|
42
|
+
- AUTHORS
|
43
|
+
- CHANGELOG.md
|
41
44
|
- Gemfile
|
42
45
|
- README.md
|
43
46
|
- Rakefile
|
44
47
|
- fluent-plugin-esslowquery.gemspec
|
48
|
+
- lib/fluent/plugin/parser_es_slow_indexing.rb
|
45
49
|
- lib/fluent/plugin/parser_es_slow_query.rb
|
50
|
+
- scripts/generate-authors.sh
|
46
51
|
homepage: https://github.com/iaintshine/fluent-plugin-esslowquery
|
47
52
|
licenses:
|
48
53
|
- MIT
|
@@ -66,5 +71,5 @@ rubyforge_project:
|
|
66
71
|
rubygems_version: 2.2.2
|
67
72
|
signing_key:
|
68
73
|
specification_version: 4
|
69
|
-
summary: Fluent parser plugin for Elasticsearch slow query log
|
74
|
+
summary: Fluent parser plugin for Elasticsearch slow query and slow indexing log files.
|
70
75
|
test_files: []
|