Class: Fluent::Plugin::MonitorAgentDetailInput::LTSVMonitorServlet

Inherits:
MonitorServlet
  • Object
show all
Defined in:
lib/fluent/plugin/in_monitor_agent_detail.rb

Instance Method Summary collapse

Methods inherited from MonitorServlet

#build_object, #do_GET, #get_search_parameter, #initialize, #render_json, #render_json_error

Constructor Details

This class inherits a constructor from Fluent::Plugin::MonitorAgentDetailInput::MonitorServlet

Instance Method Details

#process(req, res) ⇒ Object



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/fluent/plugin/in_monitor_agent_detail.rb', line 157

def process(req, res)
  list, _opts = build_object(req, res)
  return unless list

  normalized = JSON.parse(list.to_json)

  text = ''

  normalized.map {|hash|
    row = []
    hash.each_pair {|k,v|
      unless v.is_a?(Hash) || v.is_a?(Array)
        row << "#{k}:#{v}"
      end
    }
    text << row.join("\t") << "\n"
  }

  [200, {'Content-Type'=>'text/plain'}, text]
end