From b8f1af5b31784357a09c13d7d64bc4113d7c614c Mon Sep 17 00:00:00 2001 From: nilskuehme Date: Fri, 23 Sep 2022 13:43:52 +0200 Subject: [PATCH 1/2] Defined recipe --- recipes/custom_log_collection.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 recipes/custom_log_collection.rb diff --git a/recipes/custom_log_collection.rb b/recipes/custom_log_collection.rb new file mode 100644 index 00000000..867cd181 --- /dev/null +++ b/recipes/custom_log_collection.rb @@ -0,0 +1,19 @@ +include_recipe '::dd-agent' + +# node.default['datadog']['custom_log_collection']['logs'] = [ +# { +# 'type' => 'file', +# 'path' => '', +# 'source' => '', +# 'tags' => [ +# 'tag1:value1', +# 'tag2:value2' +# ] +# } +# ] + +datadog_monitor 'custom_log_collection' do + logs node['datadog']['custom_log_collection']['logs'] + action :add + notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] +end From b505d4f73b409305ea8d22592cd3d37ed4883907 Mon Sep 17 00:00:00 2001 From: nilskuehme Date: Fri, 23 Sep 2022 13:44:09 +0200 Subject: [PATCH 2/2] Added template for custom_log_collection --- templates/default/custom_log_collection.yaml.erb | 1 + 1 file changed, 1 insertion(+) create mode 100644 templates/default/custom_log_collection.yaml.erb diff --git a/templates/default/custom_log_collection.yaml.erb b/templates/default/custom_log_collection.yaml.erb new file mode 100644 index 00000000..4596766e --- /dev/null +++ b/templates/default/custom_log_collection.yaml.erb @@ -0,0 +1 @@ +<%= JSON.parse(({'logs' => @logs }).to_json).to_yaml -%>