Skip to content

Commit a5c24a8

Browse files
authored
Add dd_security_events option to spec (#17737)
1 parent 3ee9790 commit a5c24a8

File tree

6 files changed

+56
-0
lines changed

6 files changed

+56
-0
lines changed

win32_event_log/assets/configuration/spec.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,27 @@ files:
8080
channel (you cannot subscribe to Analytic or Debug channels).
8181
8282
The path is required if `legacy_mode` is set to `false`.
83+
84+
The `path` option cannot be used with the `dd_security_events` option.
8385
value:
8486
type: string
87+
- name: dd_security_events
88+
description: |
89+
Starting with Agent 7.54, you can automatically send Security Events to Datadog as Logs
90+
by using the `dd_security_events` option.
91+
92+
Supported values:
93+
- `low`: sends only the most important and crtical Security events
94+
- `high`: sends a higher volume of Security events
95+
96+
The `dd_security_events` option cannot be used with the `path` option.
97+
value:
98+
type: string
99+
display_default:
100+
example: high
101+
enum:
102+
- high
103+
- low
85104
- name: start
86105
description: |
87106
The point at which to start the event subscription.

win32_event_log/datadog_checks/win32_event_log/check.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class Win32EventLogCheck(AgentCheck, ConfigMixin):
5959
'event_format',
6060
)
6161

62+
NEW_PARAMS = ('dd_security_events',)
63+
6264
# https://docs.microsoft.com/en-us/windows/win32/wes/eventmanifestschema-leveltype-complextype#remarks
6365
#
6466
# From
@@ -154,6 +156,10 @@ def __init__(self, name, init_config, instances):
154156
"%s config option is ignored unless running legacy mode. Please remove it", legacy_param
155157
)
156158

159+
for new_param in self.NEW_PARAMS:
160+
if new_param in self.instance:
161+
self.warning("%s config option is ignored when running legacy_mode_v2. Please remove it", new_param)
162+
157163
def check(self, _):
158164
for event in self.consume_events():
159165
try:

win32_event_log/datadog_checks/win32_event_log/config_models/instance.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class InstanceConfig(BaseModel):
4949
)
5050
auth_type: Optional[Literal['default', 'negotiate', 'kerberos', 'ntlm']] = None
5151
bookmark_frequency: Optional[int] = None
52+
dd_security_events: Optional[Literal['high', 'low']] = None
5253
disable_generic_tags: Optional[bool] = None
5354
domain: Optional[str] = None
5455
empty_default_hostname: Optional[bool] = None

win32_event_log/datadog_checks/win32_event_log/data/conf.yaml.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,23 @@ instances:
7272
## channel (you cannot subscribe to Analytic or Debug channels).
7373
##
7474
## The path is required if `legacy_mode` is set to `false`.
75+
##
76+
## The `path` option cannot be used with the `dd_security_events` option.
7577
#
7678
# path: <PATH>
7779

80+
## @param dd_security_events - string - optional
81+
## Starting with Agent 7.54, you can automatically send Security Events to Datadog as Logs
82+
## by using the `dd_security_events` option.
83+
##
84+
## Supported values:
85+
## - `low`: sends only the most important and crtical Security events
86+
## - `high`: sends a higher volume of Security events
87+
##
88+
## The `dd_security_events` option cannot be used with the `path` option.
89+
#
90+
# dd_security_events: high
91+
7892
## @param start - string - optional - default: now
7993
## The point at which to start the event subscription.
8094
##

win32_event_log/datadog_checks/win32_event_log/legacy/win32_event_log.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class Win32EventLogWMI(WinWMICheck):
3838
'timeout',
3939
'payload_size',
4040
'bookmark_frequency',
41+
'dd_security_events',
4142
)
4243

4344
def __init__(self, name, init_config, instances):

win32_event_log/tests/test_config.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,18 @@ def test_invalid_message_filter_regular_expression(dd_run_check, new_check, inst
1616
match='Error compiling pattern for option `{}`: invalid group reference 1 at position 1'.format(option),
1717
):
1818
dd_run_check(check)
19+
20+
21+
def test_legacy_v2_params_notice(dd_run_check, new_check, instance):
22+
instance['dd_security_events'] = 'high'
23+
check = new_check(instance)
24+
dd_run_check(check)
25+
assert (
26+
'dd_security_events config option is ignored when running legacy_mode_v2. Please remove it'
27+
) in check.get_warnings()
28+
29+
30+
def test_legacy_v2_params_defaults_dont_notice(dd_run_check, new_check, instance):
31+
check = new_check(instance)
32+
dd_run_check(check)
33+
assert not check.get_warnings()

0 commit comments

Comments
 (0)