From 6bd86dee0920e47883fb18b21dba34dae6a5d88f Mon Sep 17 00:00:00 2001 From: David Vanhoucke Date: Thu, 18 Jan 2024 11:17:22 +0000 Subject: [PATCH] add apstate pipeline --- resources/providers/config.rb | 38 ++++++++++++++++++- .../default/apstate_apstate.conf.erb | 7 ++++ resources/templates/default/pipelines.yml.erb | 3 ++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 resources/templates/default/apstate_apstate.conf.erb diff --git a/resources/providers/config.rb b/resources/providers/config.rb index 39a8f79..93c3376 100644 --- a/resources/providers/config.rb +++ b/resources/providers/config.rb @@ -70,7 +70,7 @@ pipelines = [] if is_manager - pipelines = %w[ sflow netflow vault scanner nmsp location mobility meraki radius rbwindow bulkstats redfish monitor ] + pipelines = %w[ sflow netflow vault scanner nmsp location mobility meraki apstate radius rbwindow bulkstats redfish monitor ] elsif is_proxy pipelines = %w[ bulkstats redfish ] end @@ -657,6 +657,42 @@ end end + #apstate pipeline + if is_manager + template "#{pipelines_dir}/apstate/00_input.conf" do + source "input_kafka.conf.erb" + owner user + group user + mode 0644 + ignore_failure true + cookbook "logstash" + variables(:topics => ["rb_state"]) + notifies :restart, "service[logstash]", :delayed + end + + template "#{pipelines_dir}/apstate/01_apstate.conf" do + source "apstate_apstate.conf.erb" + owner user + group user + mode 0644 + ignore_failure true + cookbook "logstash" + notifies :restart, "service[logstash]", :delayed + end + + template "#{pipelines_dir}/apstate/99_output.conf" do + source "output_kafka_namespace.conf.erb" + owner user + group user + mode 0644 + ignore_failure true + cookbook "logstash" + variables(:output_topic => "rb_state_post", + :namespaces => namespaces) + notifies :restart, "service[logstash]", :delayed + end + end + # Rbwindow pipelines if is_manager template "#{pipelines_dir}/rbwindow/00_input.conf" do diff --git a/resources/templates/default/apstate_apstate.conf.erb b/resources/templates/default/apstate_apstate.conf.erb new file mode 100644 index 0000000..4adaac1 --- /dev/null +++ b/resources/templates/default/apstate_apstate.conf.erb @@ -0,0 +1,7 @@ +filter { + apstate { + } + mutate { + remove_field => ["@version","@timestamp"] + } +} \ No newline at end of file diff --git a/resources/templates/default/pipelines.yml.erb b/resources/templates/default/pipelines.yml.erb index d1e26ff..99bfa52 100644 --- a/resources/templates/default/pipelines.yml.erb +++ b/resources/templates/default/pipelines.yml.erb @@ -30,6 +30,9 @@ - pipeline.id: mobility-pipeline path.config: "/etc/logstash/pipelines/mobility" pipeline.workers: 1 +- pipeline.id: apstate-pipeline + path.config: "/etc/logstash/pipelines/apstate" + pipeline.workers: 1 - pipeline.id: rbwindow-pipeline path.config: "/etc/logstash/pipelines/rbwindow" pipeline.workers: 1