logstash-codec-bulk_es 0.1.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44cdb572191ef2068b39fff37f87d1eaf4717645
4
- data.tar.gz: 84cc6646da86bb301b4b75d776217104be74d1a0
3
+ metadata.gz: 0dec955882f2ef0b9ebbfa1da8aa301a98f661b9
4
+ data.tar.gz: d8f5a5efb014f6975dbeeb8fbe1ae25122712f21
5
5
  SHA512:
6
- metadata.gz: fde5ab13408ff4e8f0124fb047bda9a564ee121c39899b29143f8e6f222721614a31c341de950bbd89af9b5ea61985ba17373ca2321e14b59172e99850565e42
7
- data.tar.gz: 732dce625eb78d10ea236783a0471f2fbd1d9dcf52bf06c7727b1eb5f7d80c95fca1bb99317949e50832b857eb6cbddaf04898706b1616a10b527065af14d7e5
6
+ metadata.gz: a6b2ec95d82713a1e637a404c47e2b237f6ca45a442c29ea6cf2cc785983abff18379ac9d089e2678adc45732f4a636cd55a3f227c4b6c2b62765d6514d330c1
7
+ data.tar.gz: 006e60a7a45f795220242fcebc85901a499d296d8f789232f76344bf10f0ec4a0fb841ade1bf704d833b40b64eeaef3bfd965b3998bdedc058513f74cfe78f35
data/CONTRIBUTORS CHANGED
@@ -2,7 +2,7 @@ The following is a list of people who have contributed ideas, code, bug
2
2
  reports, or in general have helped logstash along its way.
3
3
 
4
4
  Contributors:
5
- * - saran.ramjeet@gmail.com
5
+ * - Ramjeet Saran (saran.ramjeet@gmail.com)
6
6
 
7
7
  Note: If you've sent us patches, bug reports, or otherwise contributed to
8
8
  Logstash, and you aren't on the list above and want to be, please let us know
@@ -5,16 +5,25 @@ require "logstash/json"
5
5
  require "logstash/namespace"
6
6
 
7
7
 
8
- # Todo add description
8
+ # This codec decodes the incoming meesage into http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html[Elasticsearch bulk format]
9
+ # into individual events, and metadata into the `@metadata` field.
10
+ #
11
+ # Encoding is not supported.
9
12
  class LogStash::Codecs::BulkEs < LogStash::Codecs::Base
10
13
 
11
14
  # The codec name
12
15
  config_name "bulk_es"
13
16
 
17
+ private
18
+ def log_failure(message, opts)
19
+ @logger.error("[BulkES Json Parse Failure] #{message}", opts)
20
+ end
21
+
22
+ public
14
23
  def register
15
24
  @lines = LogStash::Codecs::Line.new
16
25
  @lines.charset = "UTF-8"
17
- @state = :start
26
+ @state = :init
18
27
  @metadata = Hash.new
19
28
  end # def register
20
29
 
@@ -35,20 +44,25 @@ class LogStash::Codecs::BulkEs < LogStash::Codecs::Base
35
44
  end
36
45
  event.set("@metadata", @metadata)
37
46
  yield event
38
- @state = :start
39
- when :start
47
+ @state = :init
48
+ when :init
40
49
  @metadata = line[line.keys[0]]
41
50
  @metadata["action"] = line.keys[0].to_s
42
51
  @state = :metadata
43
- if line.keys[0] == 'delete'
52
+ if @metadata["action"] == 'delete'
44
53
  event = LogStash::Event.new()
45
54
  event.set("@metadata", @metadata)
46
55
  yield event
47
- @state = :start
56
+ @state = :init
48
57
  end
49
58
  end
59
+
50
60
  rescue LogStash::Json::ParserError => e
51
- @logger.error("JSON parse failure. Bulk ES messages must in be UTF-8 JSON", :error => e, :data => data)
61
+ log_failure(
62
+ "messages must in be UTF-8 JSON format",
63
+ :error => e,
64
+ :data => data
65
+ )
52
66
  end
53
67
  end
54
68
  end # def decode
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-codec-bulk_es'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
4
4
  s.licenses = ['Apache License (2.0)']
5
- s.summary = 'This codec decodes messages received in the Elasticsearch bulk format'
6
- s.description = ''
7
- s.homepage = ''
5
+ s.summary = 'This codec decodes messages received in the Elasticsearch bulk format.'
6
+ s.description = 'This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program'
7
+ s.homepage = 'http://www.elastic.co/guide/en/logstash/current/index.html'
8
8
  s.authors = ['']
9
9
  s.email = 'saran.ramjeet@gmail.com'
10
10
  s.require_paths = ['lib']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-codec-bulk_es
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -52,7 +52,9 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: ''
55
+ description: This gem is a logstash plugin required to be installed on top of the
56
+ Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
57
+ gem is not a stand-alone program
56
58
  email: saran.ramjeet@gmail.com
57
59
  executables: []
58
60
  extensions: []
@@ -68,7 +70,7 @@ files:
68
70
  - CONTRIBUTORS
69
71
  - Gemfile
70
72
  - LICENSE
71
- homepage: ''
73
+ homepage: http://www.elastic.co/guide/en/logstash/current/index.html
72
74
  licenses:
73
75
  - Apache License (2.0)
74
76
  metadata:
@@ -93,7 +95,7 @@ rubyforge_project:
93
95
  rubygems_version: 2.0.14.1
94
96
  signing_key:
95
97
  specification_version: 4
96
- summary: This codec decodes messages received in the Elasticsearch bulk format
98
+ summary: This codec decodes messages received in the Elasticsearch bulk format.
97
99
  test_files:
98
100
  - spec/codecs/bulk_es_spec.rb
99
101
  - spec/spec_helper.rb