Class: Fluent::Plugin::SynerexOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_synerex.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#formatterObject

Returns the value of attribute formatter.



69
70
71
# File 'lib/fluent/plugin/out_synerex.rb', line 69

def formatter
  @formatter
end

Instance Method Details

#configure(conf) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/fluent/plugin/out_synerex.rb', line 47

def configure(conf)
  GRPC.logger.info("Configure start ")
  super

#        @lfile = File.open('/tmp/synerex_out.txt',"w+")

end

#multi_workers_ready?Boolean

def prefer_buffered_processing

  false
end

Returns:

  • (Boolean)


43
44
45
# File 'lib/fluent/plugin/out_synerex.rb', line 43

def multi_workers_ready?
  true
end

#process(tag, es) ⇒ Object



71
72
73
74
75
76
# File 'lib/fluent/plugin/out_synerex.rb', line 71

def process(tag, es)
#        @lfile.puts ( "from process:"+tag.class.to_s+":"+tag.to_s)
  es.each do |time, record|
    process_record(tag, time, record)
  end
end

#process_record(tag, time, record) ⇒ Object



86
87
88
# File 'lib/fluent/plugin/out_synerex.rb', line 86

def process_record(tag, time, record)
  response = send_message(tag, time, record)
end

#send_message(tag, time, record) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/fluent/plugin/out_synerex.rb', line 90

def send_message(tag, time, record)
#        @lfile.puts ( "tag   :"+tag.class.to_s+":"+tag.to_s)
#        @lfile.puts ("time  :"+time.class.to_s+":"+time.to_s)
#        @lfile.puts ("record:"+record.class.to_s+":"+record.to_s)

  ts = Google::Protobuf::Timestamp.new(seconds: time)
  
  rec = Proto::Fluentd::FluentdRecord.new(tag: tag.to_s, time:ts, record: record.to_s)
  code = Proto::Fluentd::FluentdRecord.encode(rec)
  
  do_notifySupply("Fluentd","tag",code)
  return nil
end

#shutdownObject

called befor stop



65
66
67
# File 'lib/fluent/plugin/out_synerex.rb', line 65

def shutdown
  super
end

#startObject

called befor start



57
58
59
60
61
62
# File 'lib/fluent/plugin/out_synerex.rb', line 57

def start
  super
  nodeserv = @server+":"+@port
#        @lfile.puts("NodeServer:"+nodeserv)        
  registerServ(nodeserv,"Fluentd-Provider")
end

#write(chunk) ⇒ Object



78
79
80
81
82
83
84
# File 'lib/fluent/plugin/out_synerex.rb', line 78

def write(chunk)
#        @lfile.puts("from chunk["+chunk.metadata.class.to_s+"]"+chunk.metadata.to_s)
  tag = chunk..tag
  chunk.each do |time, record|
    process_record(tag, time, record)
  end
end