mirror of
https://github.com/meineerde/rackstash.git
synced 2025-12-19 15:01:12 +00:00
Don't create the @version fields in events by default
This field is only relevant when actually sending JSON to Logstash. Other formats don't need it. It is thus more desireable to only include this field in a specific logstash JSON encoder.
This commit is contained in:
parent
536bb9a087
commit
2fbdf3c1f5
@ -51,7 +51,7 @@ module Rackstash
|
|||||||
FIELD_MESSAGE, # filled with #{add_message}
|
FIELD_MESSAGE, # filled with #{add_message}
|
||||||
FIELD_TAGS, # set with {#tag}
|
FIELD_TAGS, # set with {#tag}
|
||||||
FIELD_TIMESTAMP, # an ISO8601 timestamp of the log event
|
FIELD_TIMESTAMP, # an ISO8601 timestamp of the log event
|
||||||
FIELD_VERSION, # the version of the schema. Currently "1"
|
FIELD_VERSION, # the version of the Logstash JSON schema. Usually "1"
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
# @!attribute [r] fields
|
# @!attribute [r] fields
|
||||||
@ -269,8 +269,6 @@ module Rackstash
|
|||||||
# now contains an array of {Message} objects.
|
# now contains an array of {Message} objects.
|
||||||
# * We add the buffer's timestamp to the `event['@timestamp]` field as an
|
# * We add the buffer's timestamp to the `event['@timestamp]` field as an
|
||||||
# ISO 8601 formatted string. The timestamp is always in UTC.
|
# ISO 8601 formatted string. The timestamp is always in UTC.
|
||||||
# * We add the version of the logstash event format as
|
|
||||||
# `event[@version] = 1`.
|
|
||||||
#
|
#
|
||||||
# The typical event emitted here looks like this:
|
# The typical event emitted here looks like this:
|
||||||
#
|
#
|
||||||
@ -282,8 +280,7 @@ module Rackstash
|
|||||||
# #<Rackstash::Message:0x007f908b4414c0 ...>,
|
# #<Rackstash::Message:0x007f908b4414c0 ...>,
|
||||||
# #<Rackstash::Message:0x007f908d14aee0 ...>
|
# #<Rackstash::Message:0x007f908d14aee0 ...>
|
||||||
# ],
|
# ],
|
||||||
# "@timestamp" => "2016-10-17T13:37:42.000Z",
|
# "@timestamp" => "2016-10-17T13:37:42.000Z"
|
||||||
# "@version" => "1"
|
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -312,7 +309,6 @@ module Rackstash
|
|||||||
|
|
||||||
event[FIELD_MESSAGE] = messages
|
event[FIELD_MESSAGE] = messages
|
||||||
event[FIELD_TIMESTAMP] = timestamp
|
event[FIELD_TIMESTAMP] = timestamp
|
||||||
event[FIELD_VERSION] = '1'.freeze
|
|
||||||
|
|
||||||
event
|
event
|
||||||
end
|
end
|
||||||
|
|||||||
@ -429,8 +429,7 @@ describe Rackstash::Buffer do
|
|||||||
'foo' => 'bar',
|
'foo' => 'bar',
|
||||||
'message' => [message],
|
'message' => [message],
|
||||||
'tags' => ['some_tag'],
|
'tags' => ['some_tag'],
|
||||||
'@timestamp' => instance_of(String),
|
'@timestamp' => instance_of(String)
|
||||||
'@version' => '1'
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -146,8 +146,7 @@ describe Rackstash::Sink do
|
|||||||
event_spec = {
|
event_spec = {
|
||||||
'message' => [],
|
'message' => [],
|
||||||
'tags' => [],
|
'tags' => [],
|
||||||
'@timestamp' => instance_of(String),
|
'@timestamp' => instance_of(String)
|
||||||
'@version' => '1'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# only the first event is duplicated
|
# only the first event is duplicated
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user