Make max_message_size customizable

Change-Id: Id9f55733c41a46d4566cfef2ecf41c353a7aa2b4
diff --git a/README.rst b/README.rst
index 33a3bf4..355c68f 100644
--- a/README.rst
+++ b/README.rst
@@ -21,6 +21,7 @@
         metric_collector_host: 127.0.0.1
         metric_collector_port: 5567
         poolsize: 100
+        max_message_size: 262144
 
 Default values:
 
@@ -30,6 +31,7 @@
 * ``metric_collector_host: 127.0.0.1``
 * ``metric_collector_port: 5567``
 * ``poolsize: 100``
+* ``max_message_size: 262144``
 
 Local Metric collector service
 
@@ -54,6 +56,7 @@
         nagios_port: 5601
         nagios_username: nagiosadmin
         poolsize: 100
+        max_message_size: 262144
 
 Default values:
 
@@ -65,6 +68,7 @@
 * ``influxdb_timeout: 5000``
 * ``nagios_port: 8001``
 * ``poolsize: 100``
+* ``max_message_size: 262144``
 
 Remote Metric Collector service
 
@@ -91,6 +95,7 @@
         influxdb_time_precision: ms
         influxdb_username: lma
         poolsize: 100
+        max_message_size: 262144
 
 Default values:
 
@@ -105,6 +110,7 @@
 * ``influxdb_time_precision: ms``
 * ``influxdb_timeout: 5000``
 * ``poolsize: 100``
+* ``max_message_size: 262144``
 
 Aggregator service
 
@@ -127,6 +133,7 @@
         nagios_port: 5601
         nagios_username: nagiosadmin
         poolsize: 100
+        max_message_size: 262144
 
 Default values:
 
@@ -138,6 +145,7 @@
 * ``nagios_port: 8001``
 * ``nagios_default_host_alarm_clusters: 00-clusters``
 * ``poolsize: 100``
+* ``max_message_size: 262144``
 
 Ceilometer service
 
diff --git a/heka/_service.sls b/heka/_service.sls
index 7af3101..c421697 100644
--- a/heka/_service.sls
+++ b/heka/_service.sls
@@ -220,6 +220,7 @@
   - defaults:
     service_name: {{ service_name }}
     poolsize: {{ server.poolsize }}
+    max_message_size: {{ server.max_message_size }}
   - require:
     - file: heka_{{ service_name }}_conf_dir
   - require_in:
diff --git a/heka/files/toml/global.toml b/heka/files/toml/global.toml
index 30d460d..bdc2a81 100644
--- a/heka/files/toml/global.toml
+++ b/heka/files/toml/global.toml
@@ -6,7 +6,7 @@
 
 hostname="{{ grains.fqdn.split('.')[0] }}"
 
-max_message_size = 262144
+max_message_size = {{ max_message_size }}
 max_process_inject = 1
 max_timer_inject = 10
 poolsize = {{ poolsize }}
diff --git a/heka/map.jinja b/heka/map.jinja
index 297705f..07e39a2 100644
--- a/heka/map.jinja
+++ b/heka/map.jinja
@@ -54,6 +54,7 @@
     'emit_rates': True,
     'prefix_dir': default_prefix_dir,
     'elasticsearch_port': default_elasticsearch_port,
+    'max_message_size': 262144,
     'poolsize': 100,
     'automatic_starting': default_automatic_starting,
     'metric_collector_host': '127.0.0.1',
@@ -76,6 +77,7 @@
     'influxdb_tag_fields': default_influxdb_tag_fields,
     'aggregator_port': default_aggregator_port,
     'nagios_port': default_nagios_port,
+    'max_message_size': 262144,
     'poolsize': 100,
     'automatic_starting': default_automatic_starting,
     'sensu_noop_handler': default_sensu_noop_handler,
@@ -99,6 +101,7 @@
     'influxdb_timeout': default_influxdb_timeout,
     'influxdb_tag_fields': default_influxdb_tag_fields,
     'aggregator_port': default_aggregator_port,
+    'max_message_size': 262144,
     'poolsize': 100,
     'automatic_starting': default_automatic_starting,
     'sensu_noop_handler': default_sensu_noop_handler,
@@ -119,6 +122,7 @@
     'influxdb_tag_fields': default_influxdb_tag_fields,
     'nagios_port': default_nagios_port,
     'nagios_default_host_alarm_clusters': default_nagios_host_alarm_clusters,
+    'max_message_size': 262144,
     'poolsize': 100,
     'automatic_starting': default_automatic_starting,
     'sensu_noop_handler': default_sensu_noop_handler,
@@ -141,6 +145,7 @@
     'amqp_vhost': '/openstack',
     'amqp_queue': 'metering.sample',
     'resource_decoding': False,
+    'max_message_size': 262144,
     'poolsize': 100,
     'automatic_starting': default_automatic_starting,
     'sensu_noop_handler': default_sensu_noop_handler,
diff --git a/metadata/service/aggregator/cluster.yml b/metadata/service/aggregator/cluster.yml
index e95243e..35e854b 100644
--- a/metadata/service/aggregator/cluster.yml
+++ b/metadata/service/aggregator/cluster.yml
@@ -5,9 +5,11 @@
 parameters:
   _param:
     aggregator_poolsize: 100
+    aggregator_max_message_size: 262144
   heka:
     aggregator:
       automatic_starting: false
       enabled: true
       influxdb_time_precision: ms
       poolsize: ${_param:aggregator_poolsize}
+      max_message_size: ${_param:aggregator_max_message_size}
\ No newline at end of file
diff --git a/metadata/service/aggregator/single.yml b/metadata/service/aggregator/single.yml
index bf2364e..dc53ba8 100644
--- a/metadata/service/aggregator/single.yml
+++ b/metadata/service/aggregator/single.yml
@@ -5,9 +5,11 @@
 parameters:
   _param:
     aggregator_poolsize: 100
+    aggregator_max_message_size: 262144
   heka:
     aggregator:
       automatic_starting: true
       enabled: true
       influxdb_time_precision: ms
-      poolsize: ${_param:aggregator_poolsize}
\ No newline at end of file
+      poolsize: ${_param:aggregator_poolsize}
+      max_message_size: ${_param:aggregator_max_message_size}
\ No newline at end of file
diff --git a/metadata/service/ceilometer_collector/single.yml b/metadata/service/ceilometer_collector/single.yml
index eacb11d..16f8050 100644
--- a/metadata/service/ceilometer_collector/single.yml
+++ b/metadata/service/ceilometer_collector/single.yml
@@ -5,9 +5,11 @@
 parameters:
   _param:
     ceilometer_collector_poolsize: 100
+    ceilometer_collector_max_message_size: 262144
   heka:
     ceilometer_collector:
       automatic_starting: true
       enabled: true
       influxdb_time_precision: ms
       poolsize: ${_param:ceilometer_collector_poolsize}
+      max_message_size: ${_param:ceilometer_collector_max_message_size}
diff --git a/metadata/service/log_collector/single.yml b/metadata/service/log_collector/single.yml
index 5160c35..d7a53fd 100644
--- a/metadata/service/log_collector/single.yml
+++ b/metadata/service/log_collector/single.yml
@@ -5,7 +5,9 @@
 parameters:
   _param:
     log_collector_poolsize: 100
+    log_collector_max_message_size: 262144
   heka:
     log_collector:
       enabled: true
       poolsize: ${_param:log_collector_poolsize}
+      max_message_size: ${_param:log_collector_max_message_size}
diff --git a/metadata/service/metric_collector/single.yml b/metadata/service/metric_collector/single.yml
index ad183a2..420f630 100644
--- a/metadata/service/metric_collector/single.yml
+++ b/metadata/service/metric_collector/single.yml
@@ -5,8 +5,10 @@
 parameters:
   _param:
     metric_collector_poolsize: 100
+    metric_collector_max_message_size: 262144
   heka:
     metric_collector:
       enabled: true
       influxdb_time_precision: ms
       poolsize: ${_param:metric_collector_poolsize}
+      max_message_size: ${_param:metric_collector_max_message_size}
diff --git a/metadata/service/remote_collector/cluster.yml b/metadata/service/remote_collector/cluster.yml
index 9e60e86..daa7e64 100644
--- a/metadata/service/remote_collector/cluster.yml
+++ b/metadata/service/remote_collector/cluster.yml
@@ -5,9 +5,11 @@
 parameters:
   _param:
     remote_collector_poolsize: 100
+    remote_collector_max_message_size: 262144
   heka:
     remote_collector:
       automatic_starting: false
       enabled: true
       influxdb_time_precision: ms
       poolsize: ${_param:remote_collector_poolsize}
+      max_message_size: ${_param:remote_collector_max_message_size}
diff --git a/metadata/service/remote_collector/single.yml b/metadata/service/remote_collector/single.yml
index 8533ad2..acc2853 100644
--- a/metadata/service/remote_collector/single.yml
+++ b/metadata/service/remote_collector/single.yml
@@ -5,9 +5,11 @@
 parameters:
   _param:
     remote_collector_poolsize: 100
+    remote_collector_max_message_size: 262144
   heka:
     remote_collector:
       automatic_starting: true
       enabled: true
       influxdb_time_precision: ms
       poolsize: ${_param:remote_collector_poolsize}
+      max_message_size: ${_param:remote_collector_max_message_size}