Skip to content

Commit

Permalink
imperva_waf: improve config robustness and error reporting
Browse files Browse the repository at this point in the history
* prevent missing trailing slash from causing collection failure
* avoid misleading errors resulting from collection failure
  • Loading branch information
efd6 committed Feb 25, 2025
1 parent 01ffd84 commit 93cca24
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
8 changes: 8 additions & 0 deletions packages/imperva_cloud_waf/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# newer versions go on top
- version: "1.7.0"
changes:
- description: Prevent absence of trailing slash in base URL from causing data collection failure.
type: enhancement
link: https://github.com/elastic/integrations/pull/12894
- description: Improve error reporting in collection failure case.
type: enhancement
link: https://github.com/elastic/integrations/pull/12894
- version: "1.6.2"
changes:
- description: Fix error message formatting syntax in agent configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ program: |
has(state.worklist) && size(state.worklist) > 0 ?
state
:
request("GET", (state.url + "logs.index")).with({
request("GET", state.url.trim_right("/") + "/logs.index").with({
"Header":{
"Authorization": ["Basic "+string(base64(state.user+":"+state.password))],
}
Expand All @@ -46,7 +46,7 @@ program: |
"error": {
"code": string(resp.StatusCode),
"id": string(resp.Status),
"message": "GET " + state.url + "logs.index: " + (
"message": "GET " + state.url.trim_right("/") + "/logs.index: " + (
size(resp.Body) != 0 ?
string(resp.Body)
:
Expand All @@ -64,7 +64,7 @@ program: |
: v.next < size(v.worklist) ?
(
request("GET",
state.url+v.worklist[v.next].filename
state.url.trim_right("/") + v.worklist[v.next].filename
).with({
"Header":{
"Authorization": ["Basic "+string(base64(state.user + ":" + state.password))],
Expand Down Expand Up @@ -98,7 +98,7 @@ program: |
"error": {
"code": string(resp.StatusCode),
"id": string(resp.Status),
"message": "GET " + state.url+v.worklist[v.next].filename + ": " +(
"message": "GET " + state.url.trim_right("/") + v.worklist[v.next].filename + ": " +(
size(resp.Body) != 0 ?
string(resp.Body)
:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ processors:
field: ecs.version
tag: set_ecs_version
value: 8.11.0
- fail:
tag: data_collection_error
if: ctx.error?.message != null && ctx.message == null && ctx.event?.original == null
message: error message set and no data to process.
- set:
field: event.kind
tag: set_event_kind_alert
Expand Down
2 changes: 1 addition & 1 deletion packages/imperva_cloud_waf/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: 3.0.3
name: imperva_cloud_waf
title: Imperva Cloud WAF
version: "1.6.2"
version: "1.7.0"
description: Collect logs from Imperva Cloud WAF with Elastic Agent.
type: integration
categories:
Expand Down

0 comments on commit 93cca24

Please sign in to comment.