Skip to content

Commit fba133b

Browse files
cloudflare: don't update fleet health status to degraded pagination completes
Earlier, we were using `.last_response.page` to get the last page index. Since `.last_response.page` starts with the value 0 at every interval, this resulted in collecting the first page 2 times. To prevent this, we've used `.last_response.url.params.Get "page"`. This change bumps minimum Kibana version to ^8.19.4 || ~9.0.7 || ^9.1.4 and adds `do_not_log_failure: true` in set transforms to avoid updating fleet health status to degraded.
1 parent 7b9ecf7 commit fba133b

File tree

7 files changed

+49
-22
lines changed

7 files changed

+49
-22
lines changed

packages/cloudflare/_dev/deploy/docker/files/config.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,20 @@ rules:
8888
"errors": [],
8989
"messages": []
9090
}
91+
- path: /client/v4/accounts/aaabbbccc/audit_logs
92+
methods: ["GET"]
93+
request_headers:
94+
x-auth-email: user@example.com
95+
x-auth-key: xxxxxxxxxx
96+
query_params:
97+
since: "{since:.*}"
98+
page: "4"
99+
responses:
100+
- status_code: 200
101+
body: |-
102+
{
103+
"result": [],
104+
"success": true,
105+
"errors": [],
106+
"messages": []
107+
}

packages/cloudflare/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "2.32.0"
3+
changes:
4+
- description: Prevent updating fleet health status to degraded when pagination completes.
5+
type: enhancement
6+
link: https://github.com/elastic/integrations/pull/16664
27
- version: "2.31.1"
38
changes:
49
- description: Change default start time to 'now - 167h59m' to fix 'logs older than 168h0m0s are not available' error.

packages/cloudflare/data_stream/audit/_dev/test/system/test-default-config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ data_stream:
1111
auth_email: user@example.com
1212
auth_key: xxxxxxxxxx
1313
account: aaabbbccc
14+
assert:
15+
hit_count: 5

packages/cloudflare/data_stream/audit/agent/stream/httpjson.yml.hbs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ response.split:
3838
response.pagination:
3939
- set:
4040
target: url.params.page
41-
value: '[[if (ne (len .last_response.body.result) 0)]][[add .last_response.page 1]][[end]]'
41+
value: '[[if (ne (len .last_response.body.result) 0)]][[add (toInt (.last_response.url.params.Get "page")) 1]][[end]]'
4242
fail_on_template_error: true
43-
43+
do_not_log_failure: true
44+
4445
cursor:
4546
last_timestamp:
4647
value: "[[.first_event.when]]"

packages/cloudflare/data_stream/audit/sample_event.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"@timestamp": "2021-11-30T13:42:04.000Z",
33
"agent": {
4-
"ephemeral_id": "c428c629-cf48-43b5-a87e-93c5add0d235",
5-
"id": "33a24c77-05cc-4158-8802-466fcef333da",
6-
"name": "elastic-agent-14587",
4+
"ephemeral_id": "3c1b2b42-0ed4-4e3d-a006-3fdced104a81",
5+
"id": "0392f7e6-a4ab-4de6-b9ef-514d77323416",
6+
"name": "elastic-agent-20026",
77
"type": "filebeat",
8-
"version": "8.16.0"
8+
"version": "8.19.4"
99
},
1010
"cloud": {
1111
"account": {
@@ -29,26 +29,27 @@
2929
},
3030
"data_stream": {
3131
"dataset": "cloudflare.audit",
32-
"namespace": "23666",
32+
"namespace": "68685",
3333
"type": "logs"
3434
},
3535
"ecs": {
3636
"version": "8.11.0"
3737
},
3838
"elastic_agent": {
39-
"id": "33a24c77-05cc-4158-8802-466fcef333da",
39+
"id": "0392f7e6-a4ab-4de6-b9ef-514d77323416",
4040
"snapshot": false,
41-
"version": "8.16.0"
41+
"version": "8.19.4"
4242
},
4343
"event": {
4444
"action": "rotate_api_key",
4545
"agent_id_status": "verified",
4646
"category": [
4747
"iam"
4848
],
49+
"created": "2025-12-22T12:51:07.996Z",
4950
"dataset": "cloudflare.audit",
5051
"id": "8d3396e8-c903-5a66-9421-00fc34570550",
51-
"ingested": "2025-10-21T11:10:42Z",
52+
"ingested": "2025-12-22T12:51:09Z",
5253
"kind": "event",
5354
"original": "{\"action\":{\"info\":\"key digest: c6b5d100d7ce492d24c5b13160fce1cc0092ce7e8d8430e9f5cf5468868be6f6\",\"result\":true,\"type\":\"rotate_API_key\"},\"actor\":{\"email\":\"user@example.com\",\"id\":\"enl3j9du8rnx2swwd9l32qots7l54t9s\",\"ip\":\"52.91.36.10\",\"type\":\"user\"},\"id\":\"8d3396e8-c903-5a66-9421-00fc34570550\",\"interface\":\"\",\"metadata\":{},\"newValue\":\"\",\"oldValue\":\"\",\"owner\":{\"id\":\"enl3j9du8rnx2swwd9l32qots7l54t9s\"},\"resource\":{\"id\":\"enl3j9du8rnx2swwd9l32qots7l54t9s\",\"type\":\"account\"},\"when\":\"2021-11-30T13:42:04Z\"}",
5455
"outcome": "success",
@@ -57,7 +58,7 @@
5758
]
5859
},
5960
"input": {
60-
"type": "cel"
61+
"type": "httpjson"
6162
},
6263
"related": {
6364
"ip": [

packages/cloudflare/docs/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ An example event for `audit` looks as following:
121121
{
122122
"@timestamp": "2021-11-30T13:42:04.000Z",
123123
"agent": {
124-
"ephemeral_id": "c428c629-cf48-43b5-a87e-93c5add0d235",
125-
"id": "33a24c77-05cc-4158-8802-466fcef333da",
126-
"name": "elastic-agent-14587",
124+
"ephemeral_id": "3c1b2b42-0ed4-4e3d-a006-3fdced104a81",
125+
"id": "0392f7e6-a4ab-4de6-b9ef-514d77323416",
126+
"name": "elastic-agent-20026",
127127
"type": "filebeat",
128-
"version": "8.16.0"
128+
"version": "8.19.4"
129129
},
130130
"cloud": {
131131
"account": {
@@ -149,26 +149,27 @@ An example event for `audit` looks as following:
149149
},
150150
"data_stream": {
151151
"dataset": "cloudflare.audit",
152-
"namespace": "23666",
152+
"namespace": "68685",
153153
"type": "logs"
154154
},
155155
"ecs": {
156156
"version": "8.11.0"
157157
},
158158
"elastic_agent": {
159-
"id": "33a24c77-05cc-4158-8802-466fcef333da",
159+
"id": "0392f7e6-a4ab-4de6-b9ef-514d77323416",
160160
"snapshot": false,
161-
"version": "8.16.0"
161+
"version": "8.19.4"
162162
},
163163
"event": {
164164
"action": "rotate_api_key",
165165
"agent_id_status": "verified",
166166
"category": [
167167
"iam"
168168
],
169+
"created": "2025-12-22T12:51:07.996Z",
169170
"dataset": "cloudflare.audit",
170171
"id": "8d3396e8-c903-5a66-9421-00fc34570550",
171-
"ingested": "2025-10-21T11:10:42Z",
172+
"ingested": "2025-12-22T12:51:09Z",
172173
"kind": "event",
173174
"original": "{\"action\":{\"info\":\"key digest: c6b5d100d7ce492d24c5b13160fce1cc0092ce7e8d8430e9f5cf5468868be6f6\",\"result\":true,\"type\":\"rotate_API_key\"},\"actor\":{\"email\":\"user@example.com\",\"id\":\"enl3j9du8rnx2swwd9l32qots7l54t9s\",\"ip\":\"52.91.36.10\",\"type\":\"user\"},\"id\":\"8d3396e8-c903-5a66-9421-00fc34570550\",\"interface\":\"\",\"metadata\":{},\"newValue\":\"\",\"oldValue\":\"\",\"owner\":{\"id\":\"enl3j9du8rnx2swwd9l32qots7l54t9s\"},\"resource\":{\"id\":\"enl3j9du8rnx2swwd9l32qots7l54t9s\",\"type\":\"account\"},\"when\":\"2021-11-30T13:42:04Z\"}",
174175
"outcome": "success",
@@ -177,7 +178,7 @@ An example event for `audit` looks as following:
177178
]
178179
},
179180
"input": {
180-
"type": "cel"
181+
"type": "httpjson"
181182
},
182183
"related": {
183184
"ip": [

packages/cloudflare/manifest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: cloudflare
22
title: Cloudflare
3-
version: "2.31.1"
3+
version: "2.32.0"
44
description: Collect logs from Cloudflare with Elastic Agent.
55
type: integration
66
format_version: "3.0.2"
77
categories: [security, network, cdn_security]
88
conditions:
99
kibana:
10-
version: "^8.16.0 || ^9.0.0"
10+
version: "^8.19.4 || ~9.0.7 || ^9.1.4"
1111
icons:
1212
- src: /img/cf-logo-v.svg
1313
title: Cloudflare

0 commit comments

Comments
 (0)