MOON
Server: Apache
System: Linux vps.erhabenn.com.br 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User: sonne (1011)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //opt/microsoft/omsagent/plugin/filter_nagios_log.rb
# Copyright (c) Microsoft Corporation.  All rights reserved.
module Fluent
	class NagiosLogFilter < Filter
		Plugin.register_filter('filter_nagios_log', self)

		require_relative 'nagios_parser_lib'

		def start
			super
			@nagios_lib = NagiosModule::Nagios.new(NagiosModule::RuntimeError.new)
		end
			
		# each record represents one line from the nagios log
		def filter(tag, time, record)
			records = @nagios_lib.parse_and_wrap(record["message"])
			# only return non empty records
			if !records.empty?
				return records
			end
		end
	end
end