Enforce timezone setting in log processing
Change-Id: I1fc5ecf8471c2effa1dadd72cf369c64bb11ec41
Closes-Bug: #1633074
(cherry picked from commit 737336a09c
)
This commit is contained in:
parent
8a418d56fe
commit
20c51d5991
|
@ -18,6 +18,7 @@ define heka::encoder::es_json (
|
||||||
$index = undef,
|
$index = undef,
|
||||||
$ensure = present,
|
$ensure = present,
|
||||||
$fields = undef,
|
$fields = undef,
|
||||||
|
$timestamp = '%Y-%m-%dT%H:%M:%S',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include heka::params
|
include heka::params
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
type = "ESJsonEncoder"
|
type = "ESJsonEncoder"
|
||||||
index = "<%= @index %>"
|
index = "<%= @index %>"
|
||||||
es_index_from_timestamp = <%= @es_index_from_timestamp %>
|
es_index_from_timestamp = <%= @es_index_from_timestamp %>
|
||||||
|
timestamp = "<%= @timestamp %>"
|
||||||
<% if @fields -%>
|
<% if @fields -%>
|
||||||
fields = [ <%= @fields.sort.collect{ |x| '"%s"' % x }.join(", ") %> ]
|
fields = [ <%= @fields.sort.collect{ |x| '"%s"' % x }.join(", ") %> ]
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -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
|
|
@ -28,6 +28,7 @@ class lma_collector::elasticsearch (
|
||||||
config_dir => $lma_collector::params::log_config_dir,
|
config_dir => $lma_collector::params::log_config_dir,
|
||||||
index => '%{Type}-%{%Y.%m.%d}',
|
index => '%{Type}-%{%Y.%m.%d}',
|
||||||
es_index_from_timestamp => true,
|
es_index_from_timestamp => true,
|
||||||
|
timestamp => '%Y-%m-%dT%H:%M:%S%z',
|
||||||
fields => $lma_collector::params::elasticsearch_fields,
|
fields => $lma_collector::params::elasticsearch_fields,
|
||||||
notify => Class['lma_collector::service::log'],
|
notify => Class['lma_collector::service::log'],
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@ class lma_collector::logs::mysql {
|
||||||
config_dir => $config_dir,
|
config_dir => $config_dir,
|
||||||
filename => "${lma_collector::params::plugins_dir}/decoders/mysql_log.lua" ,
|
filename => "${lma_collector::params::plugins_dir}/decoders/mysql_log.lua" ,
|
||||||
config => {
|
config => {
|
||||||
syslog_pattern => $lma_collector::params::syslog_pattern
|
syslog_pattern => $lma_collector::params::syslog_pattern,
|
||||||
|
tz => $::canonical_timezone,
|
||||||
},
|
},
|
||||||
module_directory => $lua_modules_dir,
|
module_directory => $lua_modules_dir,
|
||||||
notify => Class['lma_collector::service::log'],
|
notify => Class['lma_collector::service::log'],
|
||||||
|
|
|
@ -29,6 +29,9 @@ class lma_collector::logs::openstack_decoder_splitter {
|
||||||
config_dir => $lma_collector::params::log_config_dir,
|
config_dir => $lma_collector::params::log_config_dir,
|
||||||
filename => "${lma_collector::params::plugins_dir}/decoders/openstack_log.lua",
|
filename => "${lma_collector::params::plugins_dir}/decoders/openstack_log.lua",
|
||||||
module_directory => $lua_modules_dir,
|
module_directory => $lua_modules_dir,
|
||||||
|
config => {
|
||||||
|
tz => $::canonical_timezone,
|
||||||
|
},
|
||||||
notify => Class['lma_collector::service::log'],
|
notify => Class['lma_collector::service::log'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ class lma_collector::logs::pacemaker {
|
||||||
filename => "${lma_collector::params::plugins_dir}/decoders/pacemaker_log.lua",
|
filename => "${lma_collector::params::plugins_dir}/decoders/pacemaker_log.lua",
|
||||||
config => {
|
config => {
|
||||||
syslog_pattern => $lma_collector::params::syslog_pattern,
|
syslog_pattern => $lma_collector::params::syslog_pattern,
|
||||||
|
tz => $::canonical_timezone,
|
||||||
},
|
},
|
||||||
module_directory => $lua_modules_dir,
|
module_directory => $lua_modules_dir,
|
||||||
notify => Class['lma_collector::service::log'],
|
notify => Class['lma_collector::service::log'],
|
||||||
|
|
|
@ -24,6 +24,9 @@ class lma_collector::logs::rabbitmq {
|
||||||
config_dir => $config_dir,
|
config_dir => $config_dir,
|
||||||
filename => "${lma_collector::params::plugins_dir}/decoders/rabbitmq.lua" ,
|
filename => "${lma_collector::params::plugins_dir}/decoders/rabbitmq.lua" ,
|
||||||
module_directory => $lua_modules_dir,
|
module_directory => $lua_modules_dir,
|
||||||
|
config => {
|
||||||
|
tz => $::canonical_timezone,
|
||||||
|
},
|
||||||
notify => Class['lma_collector::service::log'],
|
notify => Class['lma_collector::service::log'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ class lma_collector::logs::swift (
|
||||||
filename => "${lma_collector::params::plugins_dir}/decoders/generic_syslog.lua",
|
filename => "${lma_collector::params::plugins_dir}/decoders/generic_syslog.lua",
|
||||||
config => {
|
config => {
|
||||||
syslog_pattern => $lma_collector::params::syslog_pattern,
|
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,
|
module_directory => $lua_modules_dir,
|
||||||
notify => Class['lma_collector::service::log'],
|
notify => Class['lma_collector::service::log'],
|
||||||
|
|
|
@ -25,7 +25,8 @@ class lma_collector::logs::system {
|
||||||
filename => "${lma_collector::params::plugins_dir}/decoders/generic_syslog.lua" ,
|
filename => "${lma_collector::params::plugins_dir}/decoders/generic_syslog.lua" ,
|
||||||
config => {
|
config => {
|
||||||
syslog_pattern => $lma_collector::params::syslog_pattern,
|
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,
|
module_directory => $lua_modules_dir,
|
||||||
notify => Class['lma_collector::service::log'],
|
notify => Class['lma_collector::service::log'],
|
||||||
|
|
Loading…
Reference in New Issue