summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK Jonathan Harker <k.jonathan.harker@hp.com>2013-04-17 22:15:20 +0000
committerJenkins <jenkins@review.openstack.org>2013-04-25 20:45:19 +0000
commit06c170ea0c8c9a0d805979efa4d4e7db47fdb5bd (patch)
tree65574d93c18422441eb922c570586d60f3a5717a
Use kibana as the web frontend to logstash.
Add a kibana module that installs kibana and flat configuration files, and also disables the previous boring bland web frontend. Change-Id: I772c66f07d2bc3a88128e101074be9d4162e3f8a Reviewed-on: https://review.openstack.org/27089 Reviewed-by: Jesse Keating <jesse.keating@rackspace.com> Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Reviewed-by: Jeremy Stanley <fungi@yuggoth.org> Approved: Clark Boylan <clark.boylan@gmail.com> Tested-by: Jenkins
-rw-r--r--files/config.rb140
-rw-r--r--files/kibana.init22
-rw-r--r--manifests/init.pp90
3 files changed, 252 insertions, 0 deletions
diff --git a/files/config.rb b/files/config.rb
new file mode 100644
index 0000000..7d4b800
--- /dev/null
+++ b/files/config.rb
@@ -0,0 +1,140 @@
1module KibanaConfig
2
3 # A Note: While the only option you really have to set is "Elasticsearch" it
4 # is HIGHLY recommended you glance over every option. I personally consider
5 # 'Facet_index_limit' really important.
6
7 # Your elastic search server(s). This may be set as an array for round robin
8 # load balancing
9 # Elasticsearch = ["elasticsearch1:9200","elasticsearch2:9200"]
10 Elasticsearch = "localhost:9200"
11
12 #Set the Net::HTTP read/open timeouts for the connection to the ES backend
13 ElasticsearchTimeout = 500
14
15 # The port Kibana should listen on
16 KibanaPort = 5601
17
18 # The adress ip Kibana should listen on. Comment out or set to
19 # 0.0.0.0 to listen on all interfaces.
20 KibanaHost = '127.0.0.1'
21
22 # The record type as defined in your logstash configuration.
23 # Seperate multiple types with a comma, no spaces. Leave blank
24 # for all.
25 Type = ''
26
27 # Results to show per page
28 Per_page = 100
29
30 # Timezone. Leave this set to 'user' to have the user's browser autocorrect.
31 # Otherwise, set a timezone string
32 # Examples: 'UTC', 'America/Phoenix', 'Europe/Athens', MST
33 # You can use `date +%Z` on linux to get your timezone string
34 Timezone = 'UTC'
35
36 # Format for timestamps. Defaults to mm/dd HH:MM:ss.
37 # For syntax see: http://blog.stevenlevithan.com/archives/date-time-format
38 # Time_format = 'isoDateTime'
39 Time_format = 'isoDateTime'
40
41 # Change which fields are shown by default. Must be set as an array
42 # Default_fields = ['@fields.vhost','@fields.response','@fields.request']
43 Default_fields = ['@message']
44
45 # If set to true, Kibana will use the Highlight feature of Elasticsearch to
46 # display highlighted search results
47 Highlight_results = true
48
49 # A field needs to be specified for the highlight feature. By default,
50 # Elasticsearch doesn't allow highlighting on _all because the field has to
51 # be either stored or part of the _source field.
52 Highlighted_field = "@message"
53
54 # Make URLs clickable in detailed view
55 Clickable_URLs = true
56
57 # The default operator used if no explicit operator is specified.
58 # For example, with a default operator of OR, the query capital of
59 # Hungary is translated to capital OR of OR Hungary, and with default
60 # operator of AND, the same query is translated to capital AND of AND
61 # Hungary. The default value is OR.
62 Default_operator = 'OR'
63
64 # When using analyze, use this many of the most recent
65 # results for user's query
66 Analyze_limit = 2000
67
68 # Show this many results in analyze/trend/terms/stats modes
69 Analyze_show = 25
70
71 # Show this many results in an rss feed
72 Rss_show = 25
73
74 # Show this many results in an exported file
75 Export_show = 2000
76
77 # Delimit exported file fields with what?
78 # You may want to change this to something like "\t" (tab) if you have
79 # commas in your logs
80 Export_delimiter = ","
81
82 # You may wish to insert a default search which all user searches
83 # must match. For example @source_host:www1 might only show results
84 # from www1.
85 Filter = ''
86
87 # When searching, Kibana will attempt to only search indices
88 # that match your timeframe, to make searches faster. You can
89 # turn this behavior off if you use something other than daily
90 # indexing
91 Smart_index = true
92
93 # You can define your custom pattern here for index names if you
94 # use something other than daily indexing. Pattern needs to have
95 # date formatting like '%Y.%m.%d'. Will accept an array of smart
96 # indexes.
97 # Smart_index_pattern = ['logstash-web-%Y.%m.%d', 'logstash-mail-%Y.%m.%d']
98 Smart_index_pattern = 'logstash-%Y.%m.%d'
99
100 # Number of seconds between each index. 86400 = 1 day.
101 Smart_index_step = 86400
102
103 # ElasticSearch has a default limit on URL size for REST calls,
104 # so Kibana will fall back to _all if a search spans too many
105 # indices. Use this to set that 'too many' number. By default this
106 # is set really high, ES might not like this
107 Smart_index_limit = 150
108
109 # Elasticsearch has an internal mechanism called "faceting" for performing
110 # analysis that we use for the "Stats" and "Terms" modes. However, on large
111 # data sets/queries facetting can cause ES to crash if there isn't enough
112 # memory available. It is suggested that you limit the number of indices that
113 # Kibana will use for the "Stats" and "Terms" to prevent ES crashes. For very
114 # large data sets and undersized ES clusers, a limit of 1 is not unreasonable.
115 # Default is 0 (unlimited)
116 Facet_index_limit = 0
117
118 # You probably don't want to touch anything below this line
119 # unless you really know what you're doing
120
121 # Primary field. By default Elastic Search has a special
122 # field called _all that is searched when no field is specified.
123 # Dropping _all can reduce index size significantly. If you do that
124 # you'll need to change primary_field to be '@message'
125 Primary_field = '@message'
126
127 # Default Elastic Search index to query
128 Default_index = '@message'
129
130 # TODO: This isn't functional yet
131 # Prevent wildcard search terms which result in extremely slow queries
132 # See: http:#www.elasticsearch.org/guide/reference/query-dsl/wildcard-query.html
133 Disable_fullscan = false
134
135 # Set headers to allow kibana to be loaded in an iframe from a different origin.
136 Allow_iframed = false
137
138 # Use this interval as fallback.
139 Fallback_interval = 900
140end
diff --git a/files/kibana.init b/files/kibana.init
new file mode 100644
index 0000000..9203f92
--- /dev/null
+++ b/files/kibana.init
@@ -0,0 +1,22 @@
1# kibana - web instance
2#
3# Copied from http://cookbook.logstash.net/recipes/using-upstart/
4
5description "kibana web instance"
6
7start on virtual-filesystems
8stop on runlevel [06]
9
10# Respawn it if the process exits
11respawn
12respawn limit 5 30
13expect fork
14
15chdir /opt/kibana/kibana
16
17script
18
19 su -s /bin/sh -c 'exec "$0" "$@"' kibana -- /usr/bin/ruby /opt/kibana/kibana/kibana.rb &
20 emit kibana-running
21end script
22
diff --git a/manifests/init.pp b/manifests/init.pp
new file mode 100644
index 0000000..7eebb50
--- /dev/null
+++ b/manifests/init.pp
@@ -0,0 +1,90 @@
1# Copyright 2013 Hewlett-Packard Development Company, L.P.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14#
15# Class to install kibana frontend to logstash.
16#
17class kibana {
18
19 group { 'kibana':
20 ensure => present,
21 }
22
23 user { 'kibana':
24 ensure => present,
25 comment => 'Kibana User',
26 home => '/opt/kibana',
27 gid => 'kibana',
28 shell => '/bin/bash',
29 membership => 'minimum',
30 require => Group['kibana'],
31 }
32
33 file { '/opt/kibana':
34 ensure => directory,
35 owner => 'kibana',
36 group => 'kibana',
37 mode => '0644',
38 recurse => true,
39 require => User['kibana'],
40 }
41
42 vcsrepo { '/opt/kibana/kibana':
43 ensure => latest,
44 provider => git,
45 source => 'https://github.com/rashidkpc/Kibana.git',
46 revision => 'v0.2.0',
47 require => File['/opt/kibana'],
48 }
49
50 package { 'bundler':
51 ensure => latest,
52 provider => 'gem',
53 }
54
55 exec { 'install_kibana':
56 command => 'bundle install',
57 path => ['/usr/bin', '/usr/local/bin'],
58 cwd => '/opt/kibana/kibana',
59 logoutput => true,
60 refreshonly => true,
61 subscribe => Vcsrepo['/opt/kibana/kibana'],
62 require => [
63 User['kibana'],
64 Package['bundler'],
65 ],
66 }
67
68 file { '/opt/kibana/kibana/KibanaConfig.rb':
69 ensure => present,
70 source => 'puppet:///modules/kibana/config.rb',
71 owner => 'kibana',
72 group => 'kibana',
73 require => Vcsrepo['/opt/kibana/kibana'],
74 }
75
76 file { '/etc/init/kibana.conf':
77 ensure => present,
78 source => 'puppet:///modules/kibana/kibana.init',
79 }
80
81 service { 'kibana':
82 ensure => running,
83 require => [
84 File['/etc/init/kibana.conf'],
85 File['/opt/kibana/kibana/KibanaConfig.rb'],
86 Exec['install_kibana'],
87 ],
88 }
89
90}