Today configuration is often managed by software (Chef, Ansible, etc.) with zero human interaction. Configuring Kibana4's required default index pattern on first install, however, seems to be intended to require human attendance. Is there a reason why?
We do not want to require a human to be present, and the configuration file does not seem to allow for specifying a default index pattern, so we have been forced to use an init.d script which does this:
ensure_default_index_pattern() {
local lock_file="${KIBANA_DIR}/default_index_pattern_is_defined.lock"
local url_prefix="http://localhost:9202/elasticsearch"
local index_pattern_url="${url_prefix}/.kibana/index-pattern/logstash-*?op_type=create"
local ping_url="${url_prefix}/.kibana/config/4.0.2"
local config_url="${url_prefix}/.kibana/config/4.0.2/_update"
local curl_params="--include --silent --retry 5 --retry-delay 3 --write-out %{http_code}\n --output /dev/null"
[[ -f "$lock_file" ]] && return
set -e
echo -n "Creating index pattern... "
curl $curl_params -X POST "${index_pattern_url}" -d '{"title":"logstash-*","timeFieldName":"@timestamp","customFormats":"{}"}'
echo -n "Setting index pattern as default... "
curl $curl_params -X POST "${config_url}" -d '{"doc":{"doc":{"buildNum":6004,"defaultIndex":"logstash-*"},"defaultIndex":"logstash-*"}}'
# put a lock file to tell us it's done
echo "The presence of this file indicates Kibana4 has initialized the default index pattern" > $lock_file
set +e
}
We are working on making this process easier and will be releasing automated deployment of Kibana via puppet and other config management tools in the near future.
To assist in this there will also be packaged versions of Kibana (deb/rpm).
@mpavlov Thanks for the example code! This is a huge deal for us too. Especially as in order to break up dashboards (not indexes) by groups of users we look like we will have to install many kibana instances, each with a different default.
yeah I too was faced with this, my solution (workaround) is similar to yours, I am writing directly to the .kibana index , essentially, in Ansible I will end up doing something like this in a post deploy task:
I don't really want to be writing to that index but I also did not want to use the Kibana HTTP flows...So I am interested doing this in a more supported manner.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.