Module: LogStash::Api::RackApp
- Defined in:
- lib/logstash/api/rack_app.rb
Defined Under Namespace
Classes: ApiErrorHandler, ApiLogger
Constant Summary
collapse
- METADATA_FIELDS =
[:request_method, :path_info, :query_string, :http_version, :http_accept].freeze
Class Method Summary
collapse
Class Method Details
.app(logger, agent, environment) ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/logstash/api/rack_app.rb', line 76
def self.app(logger, agent, environment)
namespaces = rack_namespaces(agent)
Rack::Builder.new do
use ApiLogger, logger
if environment != "test"
use ApiErrorHandler, logger
end
run LogStash::Api::Modules::Root.new(nil, agent)
namespaces.each_pair do |namespace, app|
map(namespace) do
run app.new(nil, agent)
end
end
end
end
|
15
16
17
18
19
20
|
# File 'lib/logstash/api/rack_app.rb', line 15
def self.log_metadata(status, env)
METADATA_FIELDS.reduce({:status => status}) do |acc, field|
acc[field] = env[field.to_s.upcase]
acc
end
end
|
.rack_namespaces(agent) ⇒ Object