-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathCreateLogsCustomDestination_2534546779.py
More file actions
45 lines (41 loc) · 1.82 KB
/
CreateLogsCustomDestination_2534546779.py
File metadata and controls
45 lines (41 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
Create a Splunk custom destination with a null sourcetype returns "OK" response
"""
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.logs_custom_destinations_api import LogsCustomDestinationsApi
from datadog_api_client.v2.model.custom_destination_create_request import CustomDestinationCreateRequest
from datadog_api_client.v2.model.custom_destination_create_request_attributes import (
CustomDestinationCreateRequestAttributes,
)
from datadog_api_client.v2.model.custom_destination_create_request_definition import (
CustomDestinationCreateRequestDefinition,
)
from datadog_api_client.v2.model.custom_destination_forward_destination_splunk import (
CustomDestinationForwardDestinationSplunk,
)
from datadog_api_client.v2.model.custom_destination_forward_destination_splunk_type import (
CustomDestinationForwardDestinationSplunkType,
)
from datadog_api_client.v2.model.custom_destination_type import CustomDestinationType
body = CustomDestinationCreateRequest(
data=CustomDestinationCreateRequestDefinition(
attributes=CustomDestinationCreateRequestAttributes(
enabled=False,
forward_tags=False,
forwarder_destination=CustomDestinationForwardDestinationSplunk(
access_token="my-access-token",
endpoint="https://example.com",
type=CustomDestinationForwardDestinationSplunkType.SPLUNK_HEC,
sourcetype=None,
),
name="Nginx logs",
query="source:nginx",
),
type=CustomDestinationType.CUSTOM_DESTINATION,
),
)
configuration = Configuration()
with ApiClient(configuration) as api_client:
api_instance = LogsCustomDestinationsApi(api_client)
response = api_instance.create_logs_custom_destination(body=body)
print(response)