fluent-plugin-splunkapi 0.1.5 → 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 CHANGED
@@ -12,6 +12,55 @@ Splunk Storm API:
12
12
 
13
13
  http://docs.splunk.com/Documentation/Storm/latest/User/UseStormsRESTAPI
14
14
 
15
+ ## Notes
16
+
17
+ Although this plugin is capable of sending Fluent events directly to
18
+ Splunk servers or Splunk Storm, it is not recommended to do so.
19
+ Please use "Universal Forwarder" as a gateway, as described below.
20
+
21
+ It is known that this plugin has several issues of performance and
22
+ error handling in dealing with large data sets. With a local/reliable
23
+ forwarder, you can aggregate a number of events locally and send them
24
+ to a server in bulk.
25
+
26
+ In short, I'd recommend to install a forwarder in each host, and use
27
+ this plugin to deliver events to the local forwarder:
28
+
29
+ <match **>
30
+ # Deliver events to the local forwarder.
31
+ type splunkapi
32
+ protocol rest
33
+ server 127.0.0.1:8089
34
+ verify false
35
+ auth admin:changeme
36
+
37
+ # Convert fluent tags to Splunk sources.
38
+ # If you set an index, "check_index false" is required.
39
+ host YOUR-HOSTNAME
40
+ index SOME-INDEX
41
+ check_index false
42
+ source {TAG}
43
+ sourcetype fluent
44
+
45
+ # TIMESTAMP: key1="value1" key2="value2" ...
46
+ time_format unixtime
47
+ format kvp
48
+
49
+ # Memory buffer with a short flush internal.
50
+ buffer_type memory
51
+ buffer_queue_limit 16
52
+ buffer_chunk_limit 8m
53
+ flush_interval 2s
54
+ </match>
55
+
56
+ ## Additional Notes
57
+
58
+ Splunk 5 has a new feature called "Modular Inputs":
59
+
60
+ http://blogs.splunk.com/2013/04/16/modular-inputs-tools/
61
+
62
+ My plan is switching to Modular Inputs rather than staying with APIs.
63
+
15
64
  ## Installation
16
65
 
17
66
  Add this line to your application's Gemfile:
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = "fluent-plugin-splunkapi"
6
- gem.version = "0.1.5"
6
+ gem.version = "0.2.0"
7
7
  gem.authors = ["Keisuke Nishida"]
8
8
  gem.email = ["knishida@bizmobile.co.jp"]
9
9
  gem.summary = %q{Splunk output plugin (REST API / Storm API) for Fluent event collector}
@@ -166,12 +166,23 @@ class SplunkAPIOutput < BufferedOutput
166
166
  # retry up to :post_retry_max times
167
167
  1.upto(@post_retry_max) do |c|
168
168
  response = @http.request uri, post
169
- break if response.code != "503"
170
169
  $log.debug "=> #{response.code} (#{response.message})"
171
- sleep @post_retry_interval
172
- # fluentd will retry processing on exception
173
- # FIXME: this may duplicate logs with multiple buffers
174
- raise "#{uri}: #{response.message}" if c == @post_retry_max
170
+ if response.code == "200"
171
+ # success
172
+ break
173
+ elsif response.code.match(/^40/)
174
+ # user error
175
+ $log.error "#{uri}: #{response.code} (#{response.message})\n#{response.body}"
176
+ break
177
+ elsif c < @post_retry_max
178
+ # retry
179
+ sleep @post_retry_interval
180
+ next
181
+ else
182
+ # other errors. fluentd will retry processing on exception
183
+ # FIXME: this may duplicate logs when using multiple buffers
184
+ raise "#{uri}: #{response.message}"
185
+ end
175
186
  end
176
187
  end
177
188
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 5
9
- version: 0.1.5
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Keisuke Nishida
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2013-07-28 00:00:00 +09:00
17
+ date: 2013-08-11 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency