logstash-output-newrelic 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 486f17e1a3bc87e00990f487a0023139643b9309e1dab8c7845ec366169af7c5
|
4
|
+
data.tar.gz: 1f19c28eac5cf94fb2a536869f81476b276d7c62bb99dbb9604596490ba0a643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86cda8ca9547298ed0ee085b3f81a61df641447d728dc27bb8e461c2fd18709baeea3fd3074589ce8415bfdfc5ca149452682468c4840468a42717e8e1b31d4f
|
7
|
+
data.tar.gz: d6041b6024a4ceced2836fad93f1fae3339387fadec9c702742572bf69f0df12e8d77f4503e8865ef857f79aa373b1061f9edf9305f67d674de38ce12d86fe9b
|
@@ -38,16 +38,6 @@ class LogStash::Outputs::NewRelic < LogStash::Outputs::Base
|
|
38
38
|
@executor&.shutdown
|
39
39
|
end
|
40
40
|
|
41
|
-
def time_to_milliseconds(time)
|
42
|
-
timestamp = time_to_logstash_timestamp(time)
|
43
|
-
if timestamp.nil?
|
44
|
-
return nil
|
45
|
-
end
|
46
|
-
|
47
|
-
(timestamp.to_f * 1000).to_i # to_f gives seconds with a fractional portion
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
41
|
def time_to_logstash_timestamp(time)
|
52
42
|
begin
|
53
43
|
LogStash::Timestamp.coerce(time)
|
@@ -70,11 +60,6 @@ class LogStash::Outputs::NewRelic < LogStash::Outputs::Base
|
|
70
60
|
if key == 'message' || key == 'timestamp'
|
71
61
|
# intrinsic attributes go at the top level
|
72
62
|
log_message_hash[key] = value
|
73
|
-
elsif key == '@timestamp'
|
74
|
-
milliseconds = time_to_milliseconds(value)
|
75
|
-
if !milliseconds.nil?
|
76
|
-
log_message_hash[:timestamp] = milliseconds
|
77
|
-
end
|
78
63
|
else
|
79
64
|
# non-intrinsic attributes get put into 'attributes'
|
80
65
|
log_message_hash[:attributes][key] = value
|
@@ -95,7 +95,7 @@ describe LogStash::Outputs::NewRelic do
|
|
95
95
|
it "message contains plugin information" do
|
96
96
|
stub_request(:any, base_uri).to_return(status: 200)
|
97
97
|
|
98
|
-
event = LogStash::Event.new({ :message => "Test message"
|
98
|
+
event = LogStash::Event.new({ :message => "Test message" })
|
99
99
|
@newrelic_output.multi_receive([event])
|
100
100
|
|
101
101
|
wait_for(a_request(:post, base_uri)
|
@@ -106,49 +106,6 @@ describe LogStash::Outputs::NewRelic do
|
|
106
106
|
.to have_been_made
|
107
107
|
end
|
108
108
|
|
109
|
-
|
110
|
-
context "@timestamp field" do
|
111
|
-
|
112
|
-
def test_timestamp(timestamp, message_matcher)
|
113
|
-
stub_request(:any, base_uri).to_return(status: 200)
|
114
|
-
|
115
|
-
event = LogStash::Event.new({ :message => "Test message", :@timestamp => timestamp })
|
116
|
-
@newrelic_output.multi_receive([event])
|
117
|
-
|
118
|
-
wait_for(a_request(:post, base_uri)
|
119
|
-
.with { |request|
|
120
|
-
message = single_gzipped_message(request.body)
|
121
|
-
message_matcher.call(message)
|
122
|
-
}).to have_been_made
|
123
|
-
end
|
124
|
-
|
125
|
-
it "LogStash::Timestamp '@timestamp' field is added as 'timestamp' as milliseconds since epoch" do
|
126
|
-
def message_matcher(message)
|
127
|
-
message['timestamp'] == FixedTime::MILLISECONDS
|
128
|
-
end
|
129
|
-
|
130
|
-
test_timestamp(FixedTime::LOGSTASH_TIMESTAMP, method(:message_matcher))
|
131
|
-
end
|
132
|
-
|
133
|
-
it "String ISO 8601 '@timestamp' field is added as 'timestamp' as milliseconds since epoch" do
|
134
|
-
def message_matcher(message)
|
135
|
-
message['timestamp'] == FixedTime::MILLISECONDS
|
136
|
-
end
|
137
|
-
|
138
|
-
test_timestamp(FixedTime::ISO_8601_STRING_TIME, method(:message_matcher))
|
139
|
-
end
|
140
|
-
|
141
|
-
# Ideally we might not even set a timestamp if parsing fails. However, the time parsing library doesn't tell us if
|
142
|
-
# parsing fails -- it just returns the current time.
|
143
|
-
it "Unparseable '@timestamp' field is parsed as current time and put into 'timestamp'" do
|
144
|
-
def message_matcher(message)
|
145
|
-
within_five_seconds_of(message['timestamp'], now_in_milliseconds)
|
146
|
-
end
|
147
|
-
|
148
|
-
test_timestamp("Not an ISO 8601 string", method(:message_matcher))
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
109
|
it "all other fields passed through as is" do
|
153
110
|
stub_request(:any, base_uri).to_return(status: 200)
|
154
111
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-newrelic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- New Relic Logging Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|