From 468c7d04fadaa7b29074024e22278080f243253e Mon Sep 17 00:00:00 2001 From: Sebastian Grund Date: Fri, 27 Sep 2024 13:00:33 +0200 Subject: [PATCH] Add host tags template only for host checks --- lib/perfdata/elasticsearchwriter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/perfdata/elasticsearchwriter.cpp b/lib/perfdata/elasticsearchwriter.cpp index 069715d27c..94d60df3bd 100644 --- a/lib/perfdata/elasticsearchwriter.cpp +++ b/lib/perfdata/elasticsearchwriter.cpp @@ -139,8 +139,10 @@ void ElasticsearchWriter::AddTemplateTags(const Dictionary::Ptr& fields, const C tie(host, service) = GetHostService(checkable); Dictionary::Ptr tmpl; - if (service && GetServiceTagsTemplate()) { - tmpl = static_pointer_cast(GetServiceTagsTemplate()->ShallowClone()); + if (service) { + if (GetServiceTagsTemplate()) { + tmpl = static_pointer_cast(GetServiceTagsTemplate()->ShallowClone()); + } } else if (GetHostTagsTemplate()) { tmpl = static_pointer_cast(GetHostTagsTemplate()->ShallowClone()); }