Sha256: 83992560eec373aeb4939b607e9256306fbcc4a9b5c3e6897dd520381e62cecf
Contents?: true
Size: 578 Bytes
Versions: 4
Compression:
Stored size: 578 Bytes
Contents
require 'fluent/plugin/parser' require 'fluent/time' require 'json' require 'sflowtool' module Fluent module Plugin class SflowParser < Parser Plugin.register_parser('sflow', self) def parse(raw, remote_host) data = JSON.load(Sflowtool.parse(raw, remote_host)) # NOTE: sFlow datagram doesn't have timestamp field, but sysUpTime only time = Fluent::EventTime.new(data['header']['unix_seconds_utc']) data['samples'].each do |sample| yield time, data['header'].merge(sample) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems