Merge lp:~cprov/charms/trusty/logstash/heap_size into lp:~canonical-is-sa/charms/trusty/logstash/logstash2

Proposed by Celso Providelo
Status: Merged
Merged at revision: 62
Proposed branch: lp:~cprov/charms/trusty/logstash/heap_size
Merge into: lp:~canonical-is-sa/charms/trusty/logstash/logstash2
Diff against target: 98 lines (+29/-2)
5 files modified
config.yaml (+5/-0)
files/limits.conf (+3/-0)
files/upstart/logstash-indexer.conf (+2/-1)
hooks/config-changed (+5/-1)
hooks/install (+14/-0)
To merge this branch: bzr merge lp:~cprov/charms/trusty/logstash/heap_size
Reviewer Review Type Date Requested Status
Michael Nelson (community) Approve
Guillermo Gonzalez Pending
Review via email: mp+311671@code.launchpad.net

This proposal supersedes a proposal from 2016-11-23.

Commit message

Allowing changing the logstash maximum heap size as a configuration.

Description of the change

Allowing changing the logstash maximum heap size as a configuration.

Defaults to 1000m instead of the application 500m default value and allow adjustments.

To post a comment you must log in.
Revision history for this message
Guillermo Gonzalez (verterok) wrote : Posted in a previous version of this proposal

Celso,

If this is to apply it to the OLS ELK, it's using a a different charm:

lp:~canonical-is-sa/charms/trusty/logstash/logstash2;revno=61,overwrite=true

the spec in use (for both staging and production) is: is/mojo-is-logging-kibana/ @ lp:canonical-mojo-specs.

review: Needs Information
Revision history for this message
Michael Nelson (michael.nelson) wrote : Posted in a previous version of this proposal
review: Approve
61. By Celso Providelo

Special (no-) limits configuration for logstash, so it can eat as much memory it is configured too.

Revision history for this message
Michael Nelson (michael.nelson) wrote :

+1 from me (see note above about using memlock)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2016-01-22 21:34:37 +0000
+++ config.yaml 2016-11-23 22:47:42 +0000
@@ -40,6 +40,11 @@
40 match => { ... }40 match => { ... }
41 }41 }
42 More info at https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html#_custom_patterns42 More info at https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html#_custom_patterns
43 heap_size:
44 default: "1000m"
45 type: string
46 description: |
47 Maximum Java heap size for the logstash process.
43 nagios_context:48 nagios_context:
44 default: "juju"49 default: "juju"
45 type: string50 type: string
4651
=== added file 'files/limits.conf'
--- files/limits.conf 1970-01-01 00:00:00 +0000
+++ files/limits.conf 2016-11-23 22:47:42 +0000
@@ -0,0 +1,3 @@
1# Ensure Logstash user can run with max open files and unlimited memlock.
2{{ USER }} - nofile 65535
3{{ USER }} - memlock unlimited
04
=== modified file 'files/upstart/logstash-indexer.conf'
--- files/upstart/logstash-indexer.conf 2014-09-23 12:11:08 +0000
+++ files/upstart/logstash-indexer.conf 2016-11-23 22:47:42 +0000
@@ -11,6 +11,7 @@
11respawn11respawn
12respawn limit 5 3012respawn limit 5 30
13env HOME={{BASEPATH}}13env HOME={{BASEPATH}}
14env LS_HEAP_SIZE={{HEAP_SIZE}}
14chdir {{BASEPATH}}15chdir {{BASEPATH}}
15setuid logstash16setuid logstash
16setgid adm17setgid adm
@@ -18,4 +19,4 @@
1819
19script20script
20 {{BASEPATH}}/bin/logstash agent -f {{BASEPATH}}/conf.d/21 {{BASEPATH}}/bin/logstash agent -f {{BASEPATH}}/conf.d/
21end script
22\ No newline at end of file22\ No newline at end of file
23end script
2324
=== modified file 'hooks/config-changed'
--- hooks/config-changed 2016-01-22 21:34:37 +0000
+++ hooks/config-changed 2016-11-23 22:47:42 +0000
@@ -113,7 +113,11 @@
113def place_upstart_template():113def place_upstart_template():
114 out = os.path.join(os.path.sep, 'etc', 'init', '{}.conf'.format(SERVICE))114 out = os.path.join(os.path.sep, 'etc', 'init', '{}.conf'.format(SERVICE))
115 templ = os.path.join('files', 'upstart')115 templ = os.path.join('files', 'upstart')
116 opts = {'BASEPATH': BASEPATH}116 config_data = hookenv.config()
117 opts = {
118 'BASEPATH': BASEPATH,
119 'HEAP_SIZE': config_data['heap_size'],
120 }
117121
118 with open(out, 'w') as p:122 with open(out, 'w') as p:
119 p.write(render('{}.conf'.format(SERVICE), opts, template_dir=templ))123 p.write(render('{}.conf'.format(SERVICE), opts, template_dir=templ))
120124
=== modified file 'hooks/install'
--- hooks/install 2015-04-17 08:26:14 +0000
+++ hooks/install 2016-11-23 22:47:42 +0000
@@ -11,6 +11,7 @@
1111
12sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))12sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))
1313
14from charmhelpers.contrib.templating.jinja import render
14from charmhelpers.core.hookenv import (15from charmhelpers.core.hookenv import (
15 config,16 config,
16 log,17 log,
@@ -52,6 +53,9 @@
52 create_skeleton()53 create_skeleton()
53 create_user()54 create_user()
5455
56 # Update logstash user limits, so it can have it all.
57 update_limits()
58
55 # finalize the installation and make sure logstash owns everything59 # finalize the installation and make sure logstash owns everything
56 subprocess.call(['chown', '-R', 'logstash', BASEPATH])60 subprocess.call(['chown', '-R', 'logstash', BASEPATH])
5761
@@ -111,6 +115,16 @@
111 except KeyError:115 except KeyError:
112 subprocess.call(['useradd', 'logstash'])116 subprocess.call(['useradd', 'logstash'])
113117
118
119def update_limits():
120 out = '/etc/security/limits.d/{}.conf'.format(SERVICE)
121 opts = {
122 'USER': 'logstash'
123 }
124 with open(out, 'w') as fd:
125 fd.write(render('limits.conf', opts, template_dir='files'))
126
127
114if __name__ == "__main__":128if __name__ == "__main__":
115 # execute a hook based on the name the program is called by129 # execute a hook based on the name the program is called by
116 hooks.execute(sys.argv)130 hooks.execute(sys.argv)

Subscribers

People subscribed via source and target branches