diff --git a/deployment_scripts/puppet/modules/heka/manifests/encoder/es_json.pp b/deployment_scripts/puppet/modules/heka/manifests/encoder/es_json.pp index 7783db2b1..908757cf0 100644 --- a/deployment_scripts/puppet/modules/heka/manifests/encoder/es_json.pp +++ b/deployment_scripts/puppet/modules/heka/manifests/encoder/es_json.pp @@ -18,6 +18,7 @@ define heka::encoder::es_json ( $index = undef, $ensure = present, $fields = undef, + $timestamp = '%Y-%m-%dT%H:%M:%S', ) { include heka::params diff --git a/deployment_scripts/puppet/modules/heka/templates/encoder/es_json.toml.erb b/deployment_scripts/puppet/modules/heka/templates/encoder/es_json.toml.erb index 75c1457a0..42bd44355 100644 --- a/deployment_scripts/puppet/modules/heka/templates/encoder/es_json.toml.erb +++ b/deployment_scripts/puppet/modules/heka/templates/encoder/es_json.toml.erb @@ -2,6 +2,7 @@ type = "ESJsonEncoder" index = "<%= @index %>" es_index_from_timestamp = <%= @es_index_from_timestamp %> +timestamp = "<%= @timestamp %>" <% if @fields -%> fields = [ <%= @fields.sort.collect{ |x| '"%s"' % x }.join(", ") %> ] <% end -%> diff --git a/deployment_scripts/puppet/modules/lma_collector/lib/facter/canonical_timezone.rb b/deployment_scripts/puppet/modules/lma_collector/lib/facter/canonical_timezone.rb new file mode 100644 index 000000000..b9b8fd6da --- /dev/null +++ b/deployment_scripts/puppet/modules/lma_collector/lib/facter/canonical_timezone.rb @@ -0,0 +1,25 @@ +# Copyright 2016 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +Facter.add("canonical_timezone") do + setcode do + tz = nil + File.open('/etc/timezone').each_line do |line| + unless line.match(/^\s*#/) + tz = line.chomp() + end + end + tz + end +end diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/elasticsearch.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/elasticsearch.pp index 7a9dce3ce..72041987d 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/elasticsearch.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/elasticsearch.pp @@ -28,6 +28,7 @@ class lma_collector::elasticsearch ( config_dir => $lma_collector::params::log_config_dir, index => '%{Type}-%{%Y.%m.%d}', es_index_from_timestamp => true, + timestamp => '%Y-%m-%dT%H:%M:%S%z', fields => $lma_collector::params::elasticsearch_fields, notify => Class['lma_collector::service::log'], } diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/mysql.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/mysql.pp index 9d744ac31..33c4c7702 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/mysql.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/mysql.pp @@ -24,7 +24,8 @@ class lma_collector::logs::mysql { config_dir => $config_dir, filename => "${lma_collector::params::plugins_dir}/decoders/mysql_log.lua" , config => { - syslog_pattern => $lma_collector::params::syslog_pattern + syslog_pattern => $lma_collector::params::syslog_pattern, + tz => $::canonical_timezone, }, module_directory => $lua_modules_dir, notify => Class['lma_collector::service::log'], diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/openstack_decoder_splitter.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/openstack_decoder_splitter.pp index fa4703417..d0abee080 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/openstack_decoder_splitter.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/openstack_decoder_splitter.pp @@ -29,6 +29,9 @@ class lma_collector::logs::openstack_decoder_splitter { config_dir => $lma_collector::params::log_config_dir, filename => "${lma_collector::params::plugins_dir}/decoders/openstack_log.lua", module_directory => $lua_modules_dir, + config => { + tz => $::canonical_timezone, + }, notify => Class['lma_collector::service::log'], } diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/pacemaker.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/pacemaker.pp index f95f26852..26abf9e23 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/pacemaker.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/pacemaker.pp @@ -25,6 +25,7 @@ class lma_collector::logs::pacemaker { filename => "${lma_collector::params::plugins_dir}/decoders/pacemaker_log.lua", config => { syslog_pattern => $lma_collector::params::syslog_pattern, + tz => $::canonical_timezone, }, module_directory => $lua_modules_dir, notify => Class['lma_collector::service::log'], diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/rabbitmq.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/rabbitmq.pp index 03672c3bc..8f6f949b6 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/rabbitmq.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/rabbitmq.pp @@ -24,6 +24,9 @@ class lma_collector::logs::rabbitmq { config_dir => $config_dir, filename => "${lma_collector::params::plugins_dir}/decoders/rabbitmq.lua" , module_directory => $lua_modules_dir, + config => { + tz => $::canonical_timezone, + }, notify => Class['lma_collector::service::log'], } diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/swift.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/swift.pp index cff470bfd..62c4d78cf 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/swift.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/swift.pp @@ -60,7 +60,8 @@ class lma_collector::logs::swift ( filename => "${lma_collector::params::plugins_dir}/decoders/generic_syslog.lua", config => { syslog_pattern => $lma_collector::params::syslog_pattern, - fallback_syslog_pattern => $lma_collector::params::fallback_syslog_pattern + fallback_syslog_pattern => $lma_collector::params::fallback_syslog_pattern, + tz => $::canonical_timezone, }, module_directory => $lua_modules_dir, notify => Class['lma_collector::service::log'], diff --git a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/system.pp b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/system.pp index d1c519722..bf3bb50f1 100644 --- a/deployment_scripts/puppet/modules/lma_collector/manifests/logs/system.pp +++ b/deployment_scripts/puppet/modules/lma_collector/manifests/logs/system.pp @@ -25,7 +25,8 @@ class lma_collector::logs::system { filename => "${lma_collector::params::plugins_dir}/decoders/generic_syslog.lua" , config => { syslog_pattern => $lma_collector::params::syslog_pattern, - fallback_syslog_pattern => $lma_collector::params::fallback_syslog_pattern + fallback_syslog_pattern => $lma_collector::params::fallback_syslog_pattern, + tz => $::canonical_timezone, }, module_directory => $lua_modules_dir, notify => Class['lma_collector::service::log'],