DEPRECATED — Gem to create Kibana URLs.
Kibana URLs are complex strings but it can be useful to create them programmatically based on data in your application. This gem helps construct working Kibana URLs configured to specific queries, index, time scopes, and more.
This was developed on Kibana 4.6.3 (but may work on other versions too).
gem install kibana_url
See below for all the options.
url_string = KibanaUrl.generate(
query: '"needle in the haystack"',
time_scope: { mode: :relative, from: Time.now - (60 * 60) }, # 1 hour ago
refresh_interval: 60 # every 1 minute
)
KibanaUrl.configure do |config|
# Provide a base URL for your Kibana endpoint (required).
config[:kibana_base_url] = 'https://kibana.intranet.net/app/kibana'
# Provide a mapping of common names and Elasticsearch log indexes (required).
config[:index_patterns] = {
app: 'application-logs-*', # first entry becomes default for URLs generated
aws: 'cloudtrail-*',
}
end
These are optional keyword arguments to the generate()
method.
log_spout
Symbol
:index_patterns
in the gem configuration.columns
Array
of String
['_source']
query
String
*
sort
Hash
with keys :log_param_name
, :mode
.:mode
can be :asc
or :desc
, :log_param_name
can be the name of any log field.{ log_param_name: 'time', mode: :desc }
.refresh_interval
Integer
nil
(which is no auto-refreshing action.)time_scope
Hash
with keys :mode
(optional), :from
(optional), :to
(optional):mode
specifies the type of time scope.:relative
will be from some given :from
time ago up to the present time and :absolute
is from a specific time ago up to another specific time.{ mode: :relative, from: 5 * 60 * 60 }
.{ mode: :relative, from: Time.new(2012, 06, 20, 10, 0, 0, "-07:00"), to: Time.new(2012, 06, 20, 14, 0, 0, "-07:00") }
Bug reports and pull requests are welcome on GitHub at https://github.com/coinbase/kibana_url.
The gem is available open source under the terms of the Apache 2.0 License.