fluent-plugin-viaq_data_model 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0eb13933dfd280f189d13bdb1990bb8d41aab5b
|
4
|
+
data.tar.gz: 821d55c5f7a85a8a2fa42c9cb64cfd9223c0289e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 274c56353afc59f26b34f2a04439260d5b3267ac94a6eaf47aa09ccd23f2aa6b9f0b6424bdbc22a85206f0366112853fc6d3ffde97941fbb4a55090e07cca473
|
7
|
+
data.tar.gz: f13e59ee0b21d33842ee4b3850a3e1b6e8f64d90ecd9359eb5a5657939c8946bde0a4a6e2996f0f0aa5451bf3fd8c147e74f7d07ab423ceb64bbaabef152b31a
|
@@ -7,7 +7,7 @@ FLUENTD_VERSION = ENV['FLUENTD_VERSION'] || "0.12.0"
|
|
7
7
|
|
8
8
|
Gem::Specification.new do |gem|
|
9
9
|
gem.name = "fluent-plugin-viaq_data_model"
|
10
|
-
gem.version = "0.0.
|
10
|
+
gem.version = "0.0.13"
|
11
11
|
gem.authors = ["Rich Megginson"]
|
12
12
|
gem.email = ["rmeggins@redhat.com"]
|
13
13
|
gem.description = %q{Filter plugin to ensure data is in the ViaQ common data model}
|
@@ -143,6 +143,8 @@ module Fluent
|
|
143
143
|
desc 'Optionally turn off processing of kubernetes events'
|
144
144
|
config_param :process_kubernetes_events, :bool, default: true
|
145
145
|
|
146
|
+
config_param :orphaned_namespace_name, :string, default: '.orphaned'
|
147
|
+
|
146
148
|
def configure(conf)
|
147
149
|
super
|
148
150
|
@keep_fields = {}
|
@@ -381,18 +383,24 @@ module Fluent
|
|
381
383
|
when :operations_full, :operations_prefix
|
382
384
|
prefix = ".operations"
|
383
385
|
when :project_full, :project_prefix
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
386
|
+
name, uuid = nil
|
387
|
+
unless record['kubernetes'].nil?
|
388
|
+
k8s = record['kubernetes']
|
389
|
+
name = k8s['namespace_name']
|
390
|
+
uuid = k8s['namespace_id']
|
391
|
+
if name.nil?
|
392
|
+
log.error("record cannot use elasticsearch index name type #{ein.name_type}: record is missing kubernetes.namespace_name field: #{record}")
|
393
|
+
end
|
394
|
+
if uuid.nil?
|
395
|
+
log.error("record cannot use elasticsearch index name type #{ein.name_type}: record is missing kubernetes.namespace_id field: #{record}")
|
396
|
+
end
|
393
397
|
else
|
394
|
-
|
398
|
+
log.error("record cannot use elasticsearch index name type #{ein.name_type}: record is missing kubernetes field: #{record}")
|
399
|
+
end
|
400
|
+
if name.nil? || uuid.nil?
|
401
|
+
name = @orphaned_namespace_name
|
395
402
|
end
|
403
|
+
prefix = name == @orphaned_namespace_name ? @orphaned_namespace_name : "project.#{name}.#{uuid}"
|
396
404
|
end
|
397
405
|
|
398
406
|
if ENV['CDM_DEBUG']
|
@@ -1141,8 +1141,10 @@ class ViaqDataModelFilterTest < Test::Unit::TestCase
|
|
1141
1141
|
tag "**"
|
1142
1142
|
name_type project_prefix
|
1143
1143
|
</elasticsearch_index_name>
|
1144
|
+
elasticsearch_index_prefix_field my_index_prefix
|
1144
1145
|
')
|
1145
1146
|
assert_match /record is missing kubernetes field/, @dlog.logs[0]
|
1147
|
+
assert_equal('.orphaned', rec['my_index_prefix'])
|
1146
1148
|
end
|
1147
1149
|
test 'log error if missing kubernetes.namespace_name field' do
|
1148
1150
|
input = normal_input.merge({})
|
@@ -1157,6 +1159,7 @@ class ViaqDataModelFilterTest < Test::Unit::TestCase
|
|
1157
1159
|
tag "kubernetes.journal.container**"
|
1158
1160
|
type k8s_journal
|
1159
1161
|
remove_keys log,stream,MESSAGE,_SOURCE_REALTIME_TIMESTAMP,__REALTIME_TIMESTAMP,CONTAINER_ID,CONTAINER_ID_FULL,CONTAINER_NAME,PRIORITY,_BOOT_ID,_CAP_EFFECTIVE,_CMDLINE,_COMM,_EXE,_GID,_HOSTNAME,_MACHINE_ID,_PID,_SELINUX_CONTEXT,_SYSTEMD_CGROUP,_SYSTEMD_SLICE,_SYSTEMD_UNIT,_TRANSPORT,_UID,_AUDIT_LOGINUID,_AUDIT_SESSION,_SYSTEMD_OWNER_UID,_SYSTEMD_SESSION,_SYSTEMD_USER_UNIT,CODE_FILE,CODE_FUNCTION,CODE_LINE,ERRNO,MESSAGE_ID,RESULT,UNIT,_KERNEL_DEVICE,_KERNEL_SUBSYSTEM,_UDEV_SYSNAME,_UDEV_DEVNODE,_UDEV_DEVLINK,SYSLOG_FACILITY,SYSLOG_IDENTIFIER,SYSLOG_PID
|
1162
|
+
elasticsearch_index_name_field my_index_name
|
1160
1163
|
</formatter>
|
1161
1164
|
<elasticsearch_index_name>
|
1162
1165
|
tag "journal.system** system.var.log** **_default_** **_openshift_** **_openshift-infra_** mux.ops"
|
@@ -1166,8 +1169,10 @@ class ViaqDataModelFilterTest < Test::Unit::TestCase
|
|
1166
1169
|
tag "**"
|
1167
1170
|
name_type project_prefix
|
1168
1171
|
</elasticsearch_index_name>
|
1172
|
+
elasticsearch_index_prefix_field my_index_prefix
|
1169
1173
|
')
|
1170
1174
|
assert_match /record is missing kubernetes.namespace_name field/, @dlog.logs[0]
|
1175
|
+
assert_equal('.orphaned', rec['my_index_prefix'])
|
1171
1176
|
end
|
1172
1177
|
test 'log error if missing kubernetes.namespace_id field' do
|
1173
1178
|
input = normal_input.merge({})
|
@@ -1191,8 +1196,10 @@ class ViaqDataModelFilterTest < Test::Unit::TestCase
|
|
1191
1196
|
tag "**"
|
1192
1197
|
name_type project_prefix
|
1193
1198
|
</elasticsearch_index_name>
|
1199
|
+
elasticsearch_index_prefix_field my_index_prefix
|
1194
1200
|
')
|
1195
1201
|
assert_match /record is missing kubernetes.namespace_id field/, @dlog.logs[0]
|
1202
|
+
assert_equal('.orphaned', rec['my_index_prefix'])
|
1196
1203
|
end
|
1197
1204
|
test 'construct a kubernetes index prefix' do
|
1198
1205
|
input = normal_input.merge({})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-viaq_data_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich Megginson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|