Avoid indexing Uuid and EnvVersion fields
These fields compose every Heka message but are useless for end users. The fix consists in explicitly enumarating fields to be indexed. Change-Id: I55aa3719dad7d6b300b81aa0409d712f594c2e1e
This commit is contained in:
parent
ef2d5d8bb4
commit
7b0be2ec8d
@ -17,10 +17,15 @@ define heka::encoder::es_json (
|
||||
$es_index_from_timestamp = false,
|
||||
$index = undef,
|
||||
$ensure = present,
|
||||
$fields = undef,
|
||||
) {
|
||||
|
||||
include heka::params
|
||||
|
||||
if $fields != undef {
|
||||
validate_array($fields)
|
||||
}
|
||||
|
||||
file { "${config_dir}/encoder-${title}.toml":
|
||||
ensure => $ensure,
|
||||
content => template('heka/encoder/es_json.toml.erb'),
|
||||
|
@ -0,0 +1,32 @@
|
||||
# Copyright 2015 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.
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'heka::encoder::es_json' do
|
||||
let(:title) { :es }
|
||||
let(:facts) do
|
||||
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
|
||||
:osfamily => 'Debian'}
|
||||
end
|
||||
|
||||
describe 'with title = es' do
|
||||
let(:params) {{:config_dir => '/etc/hekad', :index => 'bar'}}
|
||||
it { is_expected.to contain_file('/etc/hekad/encoder-es.toml') }
|
||||
end
|
||||
describe 'with fields list' do
|
||||
let(:params) {{:config_dir => '/etc/hekad', :index => 'bar', :fields => ['foo', 'bar']}}
|
||||
it { is_expected.to contain_file('/etc/hekad/encoder-es.toml').with_content(/fields = \[ "bar", "foo" \]/) }
|
||||
end
|
||||
end
|
||||
|
@ -2,3 +2,6 @@
|
||||
type = "ESJsonEncoder"
|
||||
index = "<%= @index %>"
|
||||
es_index_from_timestamp = <%= @es_index_from_timestamp %>
|
||||
<% if @fields -%>
|
||||
fields = [ <%= @fields.sort.collect{ |x| '"%s"' % x }.join(", ") %> ]
|
||||
<% end -%>
|
||||
|
@ -24,6 +24,7 @@ class lma_collector::elasticsearch (
|
||||
config_dir => $lma_collector::params::config_dir,
|
||||
index => '%{Type}-%{%Y.%m.%d}',
|
||||
es_index_from_timestamp => true,
|
||||
fields => $lma_collector::params::elasticsearch_fields,
|
||||
notify => Class['lma_collector::service'],
|
||||
}
|
||||
|
||||
|
@ -142,6 +142,7 @@ class lma_collector::params {
|
||||
|
||||
$elasticsearch_server = false
|
||||
$elasticsearch_port = '9200'
|
||||
$elasticsearch_fields = ['Timestamp', 'Type', 'Logger', 'Severity', 'Payload', 'Pid', 'Hostname', 'DynamicFields']
|
||||
|
||||
$influxdb_server = false
|
||||
$influxdb_port = '8086'
|
||||
|
Loading…
Reference in New Issue
Block a user