Skip to content

Commit 49d46c2

Browse files
[Cloudflare Logpush] Set Datetime value to @timestamp field (#13400)
cloudflare_logpush: Improved the pipeline to set the value of Datetime field to @timestamp. For cloudflare_logpush.http_request datastream, added a set processor to set @timestamp value if EdgeStartTimestamp is not present, but Datetime is present.
1 parent 7ba1791 commit 49d46c2

File tree

6 files changed

+29
-1
lines changed

6 files changed

+29
-1
lines changed

packages/cloudflare_logpush/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: "1.37.1"
3+
changes:
4+
- description: Fix handling of http_request events missing `EdgeStartTimestamp`.
5+
type: bugfix
6+
link: https://github.com/elastic/integrations/pull/13400
27
- version: "1.37.0"
38
changes:
49
- description: Add parse for missing field on Firewall Event dataset.

packages/cloudflare_logpush/data_stream/http_request/_dev/test/pipeline/test-pipeline-http-request.log-expected.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,7 @@
12861286
}
12871287
},
12881288
{
1289+
"@timestamp": "2025-03-24T19:10:40.000Z",
12891290
"cloudflare_logpush": {
12901291
"http_request": {
12911292
"client": {
@@ -1296,6 +1297,7 @@
12961297
"path": "/ping"
12971298
}
12981299
},
1300+
"datetime": "2025-03-24T19:10:40.000Z",
12991301
"edge": {
13001302
"response": {
13011303
"status": 200

packages/cloudflare_logpush/data_stream/http_request/elasticsearch/ingest_pipeline/default.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,23 @@ processors:
5656
- append:
5757
field: error.message
5858
value: "{{{_ingest.on_failure_message}}}"
59+
- date:
60+
field: json.Datetime
61+
if: ctx.json?.Datetime != null && ctx.json.Datetime != ''
62+
formats:
63+
- UNIX_MS
64+
- ISO8601
65+
- yyyy-MM-dd'T'HH:mm:ssZ
66+
timezone: UTC
67+
target_field: cloudflare_logpush.http_request.datetime
68+
on_failure:
69+
- append:
70+
field: error.message
71+
value: "{{{_ingest.on_failure_message}}}"
72+
- set:
73+
field: '@timestamp'
74+
copy_from: cloudflare_logpush.http_request.datetime
75+
ignore_empty_value: true
5976
- set:
6077
field: '@timestamp'
6178
copy_from: cloudflare_logpush.http_request.edge.start_time

packages/cloudflare_logpush/data_stream/http_request/fields/fields.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@
448448
- name: name
449449
type: keyword
450450
description: The human-readable name of the zone.
451+
- name: datetime
452+
type: date
453+
description: Timestamp when the request was received
451454
- name: log.source.address
452455
type: keyword
453456
description: Source address from which the log event was read / sent from.

packages/cloudflare_logpush/docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,6 +2777,7 @@ An example event for `http_request` looks as following:
27772777
| cloudflare_logpush.http_request.content_scan.sizes | List of content object sizes. | long |
27782778
| cloudflare_logpush.http_request.content_scan.types | List of content types. | keyword |
27792779
| cloudflare_logpush.http_request.cookies | String key-value pairs for Cookies. | flattened |
2780+
| cloudflare_logpush.http_request.datetime | Timestamp when the request was received | date |
27802781
| cloudflare_logpush.http_request.edge.cf_connecting_o2o | True if the request looped through multiple zones on the Cloudflare edge. | boolean |
27812782
| cloudflare_logpush.http_request.edge.colo.code | IATA airport code of data center that received the request. | keyword |
27822783
| cloudflare_logpush.http_request.edge.colo.id | Cloudflare edge colo id. | long |

packages/cloudflare_logpush/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
format_version: "3.0.2"
22
name: cloudflare_logpush
33
title: Cloudflare Logpush
4-
version: "1.37.0"
4+
version: "1.37.1"
55
description: Collect and parse logs from Cloudflare API with Elastic Agent.
66
type: integration
77
categories:

0 commit comments

Comments
 (0)