mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
parent
bd507eba59
commit
b710536ba8
1 changed files with 7 additions and 6 deletions
|
@ -2,6 +2,7 @@
|
||||||
require "date"
|
require "date"
|
||||||
require "logstash/codecs/base"
|
require "logstash/codecs/base"
|
||||||
require "logstash/namespace"
|
require "logstash/namespace"
|
||||||
|
require "logstash/errors"
|
||||||
require "tempfile"
|
require "tempfile"
|
||||||
require "time"
|
require "time"
|
||||||
|
|
||||||
|
@ -75,20 +76,20 @@ class LogStash::Codecs::Collectd < LogStash::Codecs::Base
|
||||||
|
|
||||||
COLLECTD_TYPE_FIELDS = {
|
COLLECTD_TYPE_FIELDS = {
|
||||||
'host' => true,
|
'host' => true,
|
||||||
'@timestamp' => true,
|
'@timestamp' => true,
|
||||||
'plugin' => true,
|
'plugin' => true,
|
||||||
'plugin_instance' => true,
|
'plugin_instance' => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERVAL_VALUES_FIELDS = {
|
INTERVAL_VALUES_FIELDS = {
|
||||||
"interval" => true,
|
"interval" => true,
|
||||||
"values" => true,
|
"values" => true,
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERVAL_BASE_FIELDS = {
|
INTERVAL_BASE_FIELDS = {
|
||||||
'host' => true,
|
'host' => true,
|
||||||
'collectd_type' => true,
|
'collectd_type' => true,
|
||||||
'plugin' => true,
|
'plugin' => true,
|
||||||
'plugin_instance' => true,
|
'plugin_instance' => true,
|
||||||
'@timestamp' => true,
|
'@timestamp' => true,
|
||||||
'type_instance' => true,
|
'type_instance' => true,
|
||||||
|
@ -360,7 +361,7 @@ class LogStash::Codecs::Collectd < LogStash::Codecs::Base
|
||||||
length = ((payload.slice!(0) << 8) + payload.slice!(0)) - 4
|
length = ((payload.slice!(0) << 8) + payload.slice!(0)) - 4
|
||||||
# Validate that the part length is correct
|
# Validate that the part length is correct
|
||||||
raise(HeaderError) if length > payload.length
|
raise(HeaderError) if length > payload.length
|
||||||
|
|
||||||
body = payload.slice!(0..length-1)
|
body = payload.slice!(0..length-1)
|
||||||
|
|
||||||
field = TYPEMAP[typenum]
|
field = TYPEMAP[typenum]
|
||||||
|
@ -438,4 +439,4 @@ class LogStash::Codecs::Collectd < LogStash::Codecs::Base
|
||||||
# basically do nothing, we just want out
|
# basically do nothing, we just want out
|
||||||
end # def decode
|
end # def decode
|
||||||
|
|
||||||
end # class LogStash::Codecs::Collectd
|
end # class LogStash::Codecs::Collectd
|
Loading…
Add table
Add a link
Reference in a new issue