From 909defe1529b838644dd00eb1b39eca9f2ec0530 Mon Sep 17 00:00:00 2001 From: Thomas Hanser Date: Fri, 21 Feb 2025 17:38:30 +0100 Subject: [PATCH 1/5] Add custom configuration to nginx/metrics This allows to add custom conditions to nginx metrics. --- packages/nginx/manifest.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/nginx/manifest.yml b/packages/nginx/manifest.yml index 595e1fbc41c..3ff85de6431 100644 --- a/packages/nginx/manifest.yml +++ b/packages/nginx/manifest.yml @@ -48,6 +48,24 @@ policy_templates: show_user: true default: - http://127.0.0.1:80 + - name: custom + title: Custom configurations + description: > + Additional settings to be added to the configuration. + + Example: + + condition: ${kubernetes.labels.app} == 'ingress-nginx' + + Explanation: + + Now you can use http://${kubernetes.pod.ip} in hosts + + ATTENTION! + Be careful using this as it might break the input as those settings are not validated and can override the settings specified above. + + type: yaml + default: "" title: Collect metrics from Nginx instances description: Collecting Nginx stub status metrics owner: From f97148b23c634df0fe2c1d2e657e33c512eb249f Mon Sep 17 00:00:00 2001 From: Thomas Hanser Date: Fri, 21 Feb 2025 17:56:42 +0100 Subject: [PATCH 2/5] Update changelog.yml --- packages/nginx/changelog.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/nginx/changelog.yml b/packages/nginx/changelog.yml index 91c005f5f18..7d23ea6c35b 100644 --- a/packages/nginx/changelog.yml +++ b/packages/nginx/changelog.yml @@ -1,4 +1,9 @@ # newer versions go on top +- version: "2.4.0" + changes: + - description: Add custom configuration support for stubstatus data stream. + type: enhancement + link: https://github.com/elastic/integrations/pull/12865 - version: "2.3.0" changes: - description: Use links panel in Dashboards. From 041cc8b8bc9eb88d2c209df0a0e03c179c0b802f Mon Sep 17 00:00:00 2001 From: Thomas Hanser Date: Fri, 21 Feb 2025 18:02:09 +0100 Subject: [PATCH 3/5] fix: add custom config in correct yaml; add custom to stream config --- .../stubstatus/agent/stream/stream.yml.hbs | 3 +++ .../nginx/data_stream/stubstatus/manifest.yml | 18 ++++++++++++++++++ packages/nginx/manifest.yml | 18 ------------------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/packages/nginx/data_stream/stubstatus/agent/stream/stream.yml.hbs b/packages/nginx/data_stream/stubstatus/agent/stream/stream.yml.hbs index 1c1d1ada170..a282587aa2e 100644 --- a/packages/nginx/data_stream/stubstatus/agent/stream/stream.yml.hbs +++ b/packages/nginx/data_stream/stubstatus/agent/stream/stream.yml.hbs @@ -15,3 +15,6 @@ server_status_path: {{server_status_path}} processors: {{processors}} {{/if}} +{{#if custom}} +{{custom}} +{{/if}} diff --git a/packages/nginx/data_stream/stubstatus/manifest.yml b/packages/nginx/data_stream/stubstatus/manifest.yml index 5ff711abbbd..5f6b4751a7e 100644 --- a/packages/nginx/data_stream/stubstatus/manifest.yml +++ b/packages/nginx/data_stream/stubstatus/manifest.yml @@ -33,6 +33,24 @@ streams: show_user: false description: > Processors are used to reduce the number of fields in the exported event or to enhance the event with metadata. This executes in the agent before the events are shipped. See [Processors](https://www.elastic.co/guide/en/fleet/current/elastic-agent-processor-configuration.html) for details. + - name: custom + title: Custom configurations + description: > + Additional settings to be added to the configuration. + + Example: + + condition: ${kubernetes.labels.app} == 'ingress-nginx' + + Explanation: + + Now you can use http://${kubernetes.pod.ip} in hosts + + ATTENTION! + Be careful using this as it might break the input as those settings are not validated and can override the settings specified above. + + type: yaml + default: "" title: Nginx stub status metrics description: Collect Nginx stub status metrics elasticsearch: diff --git a/packages/nginx/manifest.yml b/packages/nginx/manifest.yml index 3ff85de6431..595e1fbc41c 100644 --- a/packages/nginx/manifest.yml +++ b/packages/nginx/manifest.yml @@ -48,24 +48,6 @@ policy_templates: show_user: true default: - http://127.0.0.1:80 - - name: custom - title: Custom configurations - description: > - Additional settings to be added to the configuration. - - Example: - - condition: ${kubernetes.labels.app} == 'ingress-nginx' - - Explanation: - - Now you can use http://${kubernetes.pod.ip} in hosts - - ATTENTION! - Be careful using this as it might break the input as those settings are not validated and can override the settings specified above. - - type: yaml - default: "" title: Collect metrics from Nginx instances description: Collecting Nginx stub status metrics owner: From 29de164ba087da203a293a7ada9041cb06ff41c1 Mon Sep 17 00:00:00 2001 From: Thomas Hanser Date: Mon, 24 Feb 2025 09:59:09 +0100 Subject: [PATCH 4/5] fix: manifest version --- packages/nginx/manifest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nginx/manifest.yml b/packages/nginx/manifest.yml index 595e1fbc41c..479ad263d04 100644 --- a/packages/nginx/manifest.yml +++ b/packages/nginx/manifest.yml @@ -1,7 +1,7 @@ format_version: "3.0.2" name: nginx title: Nginx -version: "2.3.0" +version: "2.4.0" description: Collect logs and metrics from Nginx HTTP servers with Elastic Agent. type: integration categories: From 0b3c314fc393416e75bc6ff7ceba5cb9fd04bd89 Mon Sep 17 00:00:00 2001 From: Thomas Hanser Date: Tue, 4 Mar 2025 12:40:01 +0100 Subject: [PATCH 5/5] fix: use condition only --- .../stubstatus/agent/stream/stream.yml.hbs | 4 +-- .../nginx/data_stream/stubstatus/manifest.yml | 26 +++++++------------ 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/packages/nginx/data_stream/stubstatus/agent/stream/stream.yml.hbs b/packages/nginx/data_stream/stubstatus/agent/stream/stream.yml.hbs index a282587aa2e..399de37392b 100644 --- a/packages/nginx/data_stream/stubstatus/agent/stream/stream.yml.hbs +++ b/packages/nginx/data_stream/stubstatus/agent/stream/stream.yml.hbs @@ -15,6 +15,6 @@ server_status_path: {{server_status_path}} processors: {{processors}} {{/if}} -{{#if custom}} -{{custom}} +{{#if condition}} +condition: {{ condition }} {{/if}} diff --git a/packages/nginx/data_stream/stubstatus/manifest.yml b/packages/nginx/data_stream/stubstatus/manifest.yml index 5f6b4751a7e..4cf97911476 100644 --- a/packages/nginx/data_stream/stubstatus/manifest.yml +++ b/packages/nginx/data_stream/stubstatus/manifest.yml @@ -33,24 +33,16 @@ streams: show_user: false description: > Processors are used to reduce the number of fields in the exported event or to enhance the event with metadata. This executes in the agent before the events are shipped. See [Processors](https://www.elastic.co/guide/en/fleet/current/elastic-agent-processor-configuration.html) for details. - - name: custom - title: Custom configurations + - name: condition + title: Condition + type: text + multi: false + required: false + show_user: false description: > - Additional settings to be added to the configuration. - - Example: - - condition: ${kubernetes.labels.app} == 'ingress-nginx' - - Explanation: - - Now you can use http://${kubernetes.pod.ip} in hosts - - ATTENTION! - Be careful using this as it might break the input as those settings are not validated and can override the settings specified above. - - type: yaml - default: "" + Condition to filter when to apply this datastream + Example: "${kubernetes.labels.app} == 'ingress-nginx'" + Now you can use http://${kubernetes.pod.ip} as hosts title: Nginx stub status metrics description: Collect Nginx stub status metrics elasticsearch: