logstash-output-sumologic 1.0.1 → 1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -1
- data/lib/logstash/outputs/sumologic.rb +34 -3
- data/logstash-output-sumologic.gemspec +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86ecf0081881a1de4ccc873889d9065114305bc5
|
|
4
|
+
data.tar.gz: c659e13780a0e411fb3a86cf77fb92cd2edc05dc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88dac02a46beb121ff26695830393b5cdfcb5f04bbe0590f66f0c851188058becd8213eacc8e95cd8ffe62a173b53bb4b0ec76c93ed38ffb0250907dec756a1b
|
|
7
|
+
data.tar.gz: 4727a56d56419154cdb5185a9efbf581aa27e9b714529a1915f6fde9468cadfe771f3500847474da40355290fe31d632b51691d5308a8c6566b25f3143c76605
|
data/CHANGELOG.md
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
## 1.0.0
|
|
2
|
-
- First public release
|
|
2
|
+
- First public release
|
|
3
|
+
|
|
4
|
+
### 1.0.1
|
|
5
|
+
- Update gem description
|
|
6
|
+
|
|
7
|
+
### 1.0.2
|
|
8
|
+
- Support using `%{@json}` in format to send event in json format
|
|
9
|
+
- Support pararmeter `json_mapping` to filter json fields. For example:
|
|
10
|
+
```
|
|
11
|
+
json_mapping => {
|
|
12
|
+
"foo" => "%{@timestamp}"
|
|
13
|
+
"bar" => "%{message}"
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
will create message as:
|
|
17
|
+
```
|
|
18
|
+
{"foo":"2016-07-27T18:37:59.460Z","bar":"hello world"}
|
|
19
|
+
{"foo":"2016-07-27T18:38:01.222Z","bar":"bye!"}
|
|
20
|
+
```
|
|
@@ -26,6 +26,7 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
|
|
|
26
26
|
config :extra_headers, :validate => :hash, :default => []
|
|
27
27
|
|
|
28
28
|
# The formatter of message, by default is message with timestamp and host as prefix
|
|
29
|
+
# use %{@json} tag to send whole event
|
|
29
30
|
config :format, :validate => :string, :default => "%{@timestamp} %{host} %{message}"
|
|
30
31
|
|
|
31
32
|
# Hold messages for at least (x) seconds as a pile; 0 means sending every events immediately
|
|
@@ -34,6 +35,9 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
|
|
|
34
35
|
# Compress the payload
|
|
35
36
|
config :compress, :validate => :boolean, :default => false
|
|
36
37
|
|
|
38
|
+
# This lets you choose the structure and parts of the event that are sent in @json tag.
|
|
39
|
+
config :json_mapping, :validate => :hash
|
|
40
|
+
|
|
37
41
|
public
|
|
38
42
|
def register
|
|
39
43
|
# initialize request pool
|
|
@@ -57,7 +61,7 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
|
|
|
57
61
|
return
|
|
58
62
|
end
|
|
59
63
|
|
|
60
|
-
content = event
|
|
64
|
+
content = format_event(event)
|
|
61
65
|
|
|
62
66
|
if @interval <= 0 # means send immediately
|
|
63
67
|
send_request(content)
|
|
@@ -128,8 +132,35 @@ class LogStash::Outputs::SumoLogic < LogStash::Outputs::Base
|
|
|
128
132
|
def get_headers()
|
|
129
133
|
base = { "Content-Type" => "text/plain" }
|
|
130
134
|
base["Content-Encoding"] = "deflate" if @compress
|
|
131
|
-
|
|
132
|
-
end # def
|
|
135
|
+
base.merge(@extra_headers)
|
|
136
|
+
end # def get_headers
|
|
137
|
+
|
|
138
|
+
private
|
|
139
|
+
def format_event(event)
|
|
140
|
+
if @format.to_s.strip.length == 0
|
|
141
|
+
LogStash::Json.dump(map_event(event))
|
|
142
|
+
else
|
|
143
|
+
f = if @format.include? "%{@json}"
|
|
144
|
+
@format.gsub("%{@json}", LogStash::Json.dump(map_event(event)))
|
|
145
|
+
else
|
|
146
|
+
@format
|
|
147
|
+
end
|
|
148
|
+
event.sprintf(f)
|
|
149
|
+
end
|
|
150
|
+
end # def format_event
|
|
151
|
+
|
|
152
|
+
private
|
|
153
|
+
def map_event(event)
|
|
154
|
+
if @json_mapping
|
|
155
|
+
@json_mapping.reduce({}) do |acc, kv|
|
|
156
|
+
k, v = kv
|
|
157
|
+
acc[k] = event.sprintf(v)
|
|
158
|
+
acc
|
|
159
|
+
end
|
|
160
|
+
else
|
|
161
|
+
event.to_hash
|
|
162
|
+
end
|
|
163
|
+
end # def map_event
|
|
133
164
|
|
|
134
165
|
private
|
|
135
166
|
def log_failure(message, opts)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'logstash-output-sumologic'
|
|
3
|
-
s.version = "1.0.
|
|
3
|
+
s.version = "1.0.2"
|
|
4
4
|
s.licenses = ["Apache-2.0"]
|
|
5
5
|
s.summary = "Deliever the log to Sumo Logic cloud service."
|
|
6
6
|
s.description = "This gem is a Logstash output plugin to deliver the log to Sumo Logic cloud service. Go to https://github.com/SumoLogic/logstash-output-sumologic for getting help, reporting issues, etc."
|
|
7
7
|
s.authors = ["Sumo Logic"]
|
|
8
8
|
s.email = "byi@sumologic.com"
|
|
9
|
-
s.homepage = "
|
|
9
|
+
s.homepage = "https://github.com/SumoLogic/logstash-output-sumologic"
|
|
10
10
|
s.require_paths = ["lib"]
|
|
11
11
|
|
|
12
12
|
# Files
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logstash-output-sumologic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sumo Logic
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-07-
|
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: logstash-core
|
|
@@ -75,7 +75,7 @@ files:
|
|
|
75
75
|
- lib/logstash/outputs/sumologic.rb
|
|
76
76
|
- logstash-output-sumologic.gemspec
|
|
77
77
|
- spec/outputs/sumologic_spec.rb
|
|
78
|
-
homepage:
|
|
78
|
+
homepage: https://github.com/SumoLogic/logstash-output-sumologic
|
|
79
79
|
licenses:
|
|
80
80
|
- Apache-2.0
|
|
81
81
|
metadata:
|