Skip to content

Commit 1262596

Browse files
authored
bitdefender: migrate push_configuration and push_statistics data streams to CEL (#14787)
1 parent 4a81415 commit 1262596

File tree

15 files changed

+220
-157
lines changed

15 files changed

+220
-157
lines changed

packages/bitdefender/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.6.0"
3+
changes:
4+
- description: Migrate `push_configuration` and `push_statistics` data streams to the CEL input.
5+
type: enhancement
6+
link: https://github.com/elastic/integrations/pull/14787
27
- version: "2.5.0"
38
changes:
49
- description: Standardize user fields processing across integrations.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
input: httpjson
1+
input: cel
22
service: bitdefender-gravityzone-api-mock
33
policy_template: bitdefender_gravityzone
44
vars:
55
url: http://{{Hostname}}:{{Port}}/api/v1.0/jsonrpc/push
66
push_notification_configuration_id: test
77
api_key: api_key
8+
enable_request_tracer: true
89
data_stream:
910
vars:
1011
preserve_original_event: true
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
config_version: 2
2+
interval: {{interval}}
3+
{{#if enable_request_tracer}}
4+
resource.tracer.filename: "../../logs/cel/http-request-trace-*.ndjson"
5+
resource.tracer.maxbackups: 5
6+
{{/if}}
7+
resource.url: {{url}}
8+
{{#if proxy_url }}
9+
resource.proxy_url: {{proxy_url}}
10+
{{/if}}
11+
{{#if ssl}}
12+
resource.ssl: {{ssl}}
13+
{{/if}}
14+
{{#if http_client_timeout}}
15+
resource.timeout: {{http_client_timeout}}
16+
{{/if}}
17+
state:
18+
push_notification_configuration_id: {{push_notification_configuration_id}}
19+
api_key: {{api_key}}
20+
method: getPushEventSettings
21+
redact:
22+
fields:
23+
- api_key
24+
program: |-
25+
state.with(
26+
request("POST", state.url).with(
27+
{
28+
"Header": {
29+
"Authorization": ["Basic "+base64(state.api_key+":")],
30+
"Content-Type": ["application/json"],
31+
"Accept": ["application/json"],
32+
},
33+
"Body": {
34+
"jsonrpc": "2.0",
35+
"method": state.method,
36+
"id": state.push_notification_configuration_id,
37+
}.encode_json()
38+
}
39+
).do_request().as(resp, resp.StatusCode == 200 ?
40+
dyn({
41+
"events": [{"message":string(resp.Body)}],
42+
})
43+
:
44+
dyn({
45+
"events": {
46+
"error": {
47+
"code": string(resp.StatusCode),
48+
"id": string(resp.Status),
49+
"message": "POST: "+(
50+
size(resp.Body) != 0 ?
51+
string(resp.Body)
52+
:
53+
string(resp.Status) + ' (' + string(resp.StatusCode) + ')'
54+
),
55+
},
56+
},
57+
})
58+
)
59+
)
60+
tags:
61+
{{#if preserve_original_event}}
62+
- preserve_original_event
63+
{{/if}}
64+
{{#each tags as |tag|}}
65+
- {{tag}}
66+
{{/each}}
67+
{{#contains "forwarded" tags}}
68+
publisher_pipeline.disable_host: true
69+
{{/contains}}
70+
{{#if processors}}
71+
processors:
72+
{{processors}}
73+
{{/if}}

packages/bitdefender/data_stream/push_configuration/agent/stream/httpjson.yml.hbs

Lines changed: 0 additions & 48 deletions
This file was deleted.

packages/bitdefender/data_stream/push_configuration/elasticsearch/ingest_pipeline/default.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
---
22
description: Pipeline for BitDefender push notification configuration
33
processors:
4+
- set:
5+
field: ecs.version
6+
value: '8.11.0'
7+
- fail:
8+
tag: data_collection_error
9+
if: ctx.error?.message != null && ctx.message == null && ctx.event?.original == null
10+
message: error message set and no data to process.
411
- json:
512
field: message
613
target_field: json
714
- fail:
815
if: ctx.json == null || !(ctx.json instanceof Map)
916
message: missing json object in input document
10-
- set:
11-
field: ecs.version
12-
value: '8.11.0'
1317
- rename:
1418
field: message
1519
target_field: event.original

packages/bitdefender/data_stream/push_configuration/manifest.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
title: "BitDefender GravityZone Push Notification Configuration"
22
type: logs
33
streams:
4-
- input: httpjson
5-
template_path: httpjson.yml.hbs
4+
- input: cel
5+
template_path: cel.yml.hbs
66
title: Push Notification Configuration
77
description: Collect Push Notification Configuration Information, including current status
8+
enabled: false
89
vars:
910
- name: ssl
1011
type: yaml

packages/bitdefender/data_stream/push_configuration/sample_event.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"@timestamp": "2024-07-15T09:30:33.869Z",
2+
"@timestamp": "2025-08-04T05:45:30.706Z",
33
"agent": {
4-
"ephemeral_id": "d1d677fd-e585-4395-a4ee-8c3c2670cb99",
5-
"id": "b2122e94-e7cd-4274-9c2e-856609628a36",
6-
"name": "docker-fleet-agent",
4+
"ephemeral_id": "6add488a-b2f6-487a-af12-30506202511b",
5+
"id": "dc1ce160-e35b-4897-a9cb-680439488735",
6+
"name": "elastic-agent-51646",
77
"type": "filebeat",
8-
"version": "8.14.3"
8+
"version": "8.18.0"
99
},
1010
"bitdefender": {
1111
"id": "1",
@@ -52,29 +52,28 @@
5252
},
5353
"data_stream": {
5454
"dataset": "bitdefender.push_configuration",
55-
"namespace": "ep",
55+
"namespace": "20813",
5656
"type": "logs"
5757
},
5858
"ecs": {
5959
"version": "8.11.0"
6060
},
6161
"elastic_agent": {
62-
"id": "b2122e94-e7cd-4274-9c2e-856609628a36",
62+
"id": "dc1ce160-e35b-4897-a9cb-680439488735",
6363
"snapshot": false,
64-
"version": "8.14.3"
64+
"version": "8.18.0"
6565
},
6666
"event": {
6767
"agent_id_status": "verified",
68-
"created": "2024-07-15T09:30:33.869Z",
6968
"dataset": "bitdefender.push_configuration",
70-
"ingested": "2024-07-15T09:30:45Z",
69+
"ingested": "2025-08-04T05:45:33Z",
7170
"original": "{\"id\":\"1\",\"jsonrpc\":\"2.0\",\"result\":{\"serviceSettings\":{\"requireValidSslCertificate\":true,\"url\":\"https://your.elastic.agent/bitdefender/push/notification\"},\"serviceType\":\"qradar\",\"status\":1,\"subscribeToEventTypes\":{\"adcloud\":true,\"antiexploit\":true,\"aph\":true,\"av\":true,\"avc\":true,\"dp\":true,\"endpoint-moved-in\":true,\"endpoint-moved-out\":true,\"exchange-malware\":true,\"exchange-user-credentials\":true,\"fw\":true,\"hd\":true,\"hwid-change\":true,\"install\":true,\"modules\":true,\"network-monitor\":true,\"network-sandboxing\":true,\"new-incident\":true,\"ransomware-mitigation\":true,\"registration\":true,\"security-container-update-available\":true,\"supa-update-status\":true,\"sva\":true,\"sva-load\":true,\"task-status\":true,\"troubleshooting-activity\":true,\"uc\":true,\"uninstall\":true}}}"
7271
},
7372
"input": {
74-
"type": "httpjson"
73+
"type": "cel"
7574
},
7675
"tags": [
7776
"preserve_original_event",
7877
"forwarded"
7978
]
80-
}
79+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
input: httpjson
1+
input: cel
22
service: bitdefender-gravityzone-api-mock
33
policy_template: bitdefender_gravityzone
44
vars:
55
url: http://{{Hostname}}:{{Port}}/api/v1.0/jsonrpc/push
66
push_notification_configuration_id: test
77
api_key: api_key
8+
enable_request_tracer: true
89
data_stream:
910
vars:
1011
preserve_original_event: true
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
config_version: 2
2+
interval: {{interval}}
3+
{{#if enable_request_tracer}}
4+
resource.tracer.filename: "../../logs/cel/http-request-trace-*.ndjson"
5+
resource.tracer.maxbackups: 5
6+
{{/if}}
7+
resource.url: {{url}}
8+
{{#if proxy_url }}
9+
resource.proxy_url: {{proxy_url}}
10+
{{/if}}
11+
{{#if ssl}}
12+
resource.ssl: {{ssl}}
13+
{{/if}}
14+
{{#if http_client_timeout}}
15+
resource.timeout: {{http_client_timeout}}
16+
{{/if}}
17+
state:
18+
push_notification_configuration_id: {{push_notification_configuration_id}}
19+
api_key: {{api_key}}
20+
method: getPushEventStats
21+
redact:
22+
fields:
23+
- api_key
24+
program: |-
25+
state.with(
26+
request("POST", state.url).with(
27+
{
28+
"Header": {
29+
"Authorization": ["Basic "+base64(state.api_key+":")],
30+
"Content-Type": ["application/json"],
31+
"Accept": ["application/json"],
32+
},
33+
"Body": {
34+
"jsonrpc": "2.0",
35+
"method": state.method,
36+
"id": state.push_notification_configuration_id,
37+
}.encode_json()
38+
}
39+
).do_request().as(resp, resp.StatusCode == 200 ?
40+
dyn({
41+
"events": [{"message":string(resp.Body)}],
42+
})
43+
:
44+
dyn({
45+
"events": {
46+
"error": {
47+
"code": string(resp.StatusCode),
48+
"id": string(resp.Status),
49+
"message": "POST: "+(
50+
size(resp.Body) != 0 ?
51+
string(resp.Body)
52+
:
53+
string(resp.Status) + ' (' + string(resp.StatusCode) + ')'
54+
),
55+
},
56+
},
57+
})
58+
)
59+
)
60+
tags:
61+
{{#if preserve_original_event}}
62+
- preserve_original_event
63+
{{/if}}
64+
{{#each tags as |tag|}}
65+
- {{tag}}
66+
{{/each}}
67+
{{#contains "forwarded" tags}}
68+
publisher_pipeline.disable_host: true
69+
{{/contains}}
70+
{{#if processors}}
71+
processors:
72+
{{processors}}
73+
{{/if}}

packages/bitdefender/data_stream/push_statistics/agent/stream/httpjson.yml.hbs

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)