Sha256: fc48629218271d1a189b1c794a2c51dba4e3780594d47e9b59c2204c1f73d160
Contents?: true
Size: 1.02 KB
Versions: 90
Compression:
Stored size: 1.02 KB
Contents
module ItamaeMitsurin module Handler class Fluentd < Base attr_accessor :fluent_logger # for test def initialize(*) super load_fluent_logger end def event(type, payload = {}) super unless @fluent_logger.post(type, payload.merge(hostname: hostname)) ItamaeMitsurin.logger.warn "Sending logs to Fluentd failed: #{@fluent_logger.last_error}" end end private def load_fluent_logger begin require 'fluent-logger' rescue LoadError raise "Loading fluent-logger gem failed. Please install 'fluent-logger' gem to use fluentd handler." end @fluent_logger = Fluent::Logger::FluentLogger.new(tag_prefix, host: fluentd_host, port: fluentd_port) end def tag_prefix @options['tag_prefix'] || 'itamae_server' end def fluentd_host @options['host'] || 'localhost' end def fluentd_port (@options['port'] || 24224).to_i end end end end
Version data entries
90 entries across 47 versions & 1 rubygems