Skip to content

Commit ecc0486

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Adding valid tokens to Splunk and HTTP server source (#4112)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent e270640 commit ecc0486

18 files changed

Lines changed: 765 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54251,6 +54251,16 @@ components:
5425154251
description: Name of the environment variable or secret that holds the username (used when `auth_strategy` is `plain`).
5425254252
example: HTTP_AUTH_USERNAME
5425354253
type: string
54254+
valid_tokens:
54255+
description: |-
54256+
A list of tokens that are accepted for authenticating incoming HTTP requests. When set,
54257+
the source rejects any request whose token does not match an enabled entry in this list.
54258+
Cannot be combined with the `plain` auth strategy.
54259+
items:
54260+
$ref: "#/components/schemas/ObservabilityPipelineHttpServerSourceValidToken"
54261+
maxItems: 1000
54262+
minItems: 1
54263+
type: array
5425454264
required:
5425554265
- id
5425654266
- type
@@ -54276,6 +54286,55 @@ components:
5427654286
type: string
5427754287
x-enum-varnames:
5427854288
- HTTP_SERVER
54289+
ObservabilityPipelineHttpServerSourceValidToken:
54290+
description: An accepted token used to authenticate incoming HTTP server requests.
54291+
properties:
54292+
enabled:
54293+
default: true
54294+
description: |-
54295+
Indicates whether this token is currently accepted. Disabled tokens are rejected without
54296+
being removed from the configuration.
54297+
example: true
54298+
type: boolean
54299+
field_to_add:
54300+
$ref: "#/components/schemas/ObservabilityPipelineSourceValidTokenFieldToAdd"
54301+
path_to_token:
54302+
$ref: "#/components/schemas/ObservabilityPipelineHttpServerSourceValidTokenPathToToken"
54303+
token_key:
54304+
description: Name of the environment variable or secret that holds the expected token value.
54305+
example: HTTP_SERVER_TOKEN
54306+
pattern: "^[A-Za-z0-9_]+$"
54307+
type: string
54308+
required:
54309+
- token_key
54310+
type: object
54311+
ObservabilityPipelineHttpServerSourceValidTokenPathToToken:
54312+
description: |-
54313+
Specifies where the worker extracts the token from in the incoming HTTP request.
54314+
This can be either a built-in location (`path` or `address`) or an HTTP header object.
54315+
oneOf:
54316+
- $ref: "#/components/schemas/ObservabilityPipelineHttpServerSourceValidTokenPathToTokenLocation"
54317+
- $ref: "#/components/schemas/ObservabilityPipelineHttpServerSourceValidTokenPathToTokenHeader"
54318+
ObservabilityPipelineHttpServerSourceValidTokenPathToTokenHeader:
54319+
description: Extract the token from a specific HTTP request header.
54320+
properties:
54321+
header:
54322+
description: The name of the HTTP header that carries the token.
54323+
example: X-Token
54324+
type: string
54325+
required:
54326+
- header
54327+
type: object
54328+
ObservabilityPipelineHttpServerSourceValidTokenPathToTokenLocation:
54329+
description: Built-in token location on the incoming HTTP request.
54330+
enum:
54331+
- path
54332+
- address
54333+
example: path
54334+
type: string
54335+
x-enum-varnames:
54336+
- PATH
54337+
- ADDRESS
5427954338
ObservabilityPipelineKafkaDestination:
5428054339
description: |-
5428154340
The `kafka` destination sends logs to Apache Kafka topics.
@@ -56299,6 +56358,27 @@ components:
5629956358
type: string
5630056359
x-enum-varnames:
5630156360
- SOCKET
56361+
ObservabilityPipelineSourceValidTokenFieldToAdd:
56362+
description: |-
56363+
An optional metadata field that is attached to every event authenticated by the
56364+
associated token. Both `key` and `value` must match `^[A-Za-z0-9_]+$`.
56365+
properties:
56366+
key:
56367+
description: The metadata field name to add to incoming events.
56368+
example: token_name
56369+
maxLength: 256
56370+
pattern: "^[A-Za-z0-9_]+$"
56371+
type: string
56372+
value:
56373+
description: The metadata field value to add to incoming events.
56374+
example: my_token
56375+
maxLength: 1024
56376+
pattern: "^[A-Za-z0-9_]+$"
56377+
type: string
56378+
required:
56379+
- key
56380+
- value
56381+
type: object
5630256382
ObservabilityPipelineSpec:
5630356383
description: Input schema representing an observability pipeline configuration. Used in create and validate requests.
5630456384
properties:
@@ -56495,6 +56575,15 @@ components:
5649556575
$ref: "#/components/schemas/ObservabilityPipelineTls"
5649656576
type:
5649756577
$ref: "#/components/schemas/ObservabilityPipelineSplunkHecSourceType"
56578+
valid_tokens:
56579+
description: |-
56580+
A list of tokens that are accepted for authenticating incoming HEC requests. When set, the source
56581+
rejects any request whose HEC token does not match an enabled entry in this list.
56582+
items:
56583+
$ref: "#/components/schemas/ObservabilityPipelineSplunkHecSourceValidToken"
56584+
maxItems: 1000
56585+
minItems: 1
56586+
type: array
5649856587
required:
5649956588
- id
5650056589
- type
@@ -56509,6 +56598,26 @@ components:
5650956598
type: string
5651056599
x-enum-varnames:
5651156600
- SPLUNK_HEC
56601+
ObservabilityPipelineSplunkHecSourceValidToken:
56602+
description: An accepted HEC token used to authenticate incoming Splunk HEC requests.
56603+
properties:
56604+
enabled:
56605+
default: true
56606+
description: |-
56607+
Indicates whether this token is currently accepted. Disabled tokens are rejected without
56608+
being removed from the configuration.
56609+
example: true
56610+
type: boolean
56611+
field_to_add:
56612+
$ref: "#/components/schemas/ObservabilityPipelineSourceValidTokenFieldToAdd"
56613+
token_key:
56614+
description: Name of the environment variable or secret that holds the expected HEC token value.
56615+
example: SPLUNK_HEC_TOKEN
56616+
pattern: "^[A-Za-z0-9_]+$"
56617+
type: string
56618+
required:
56619+
- token_key
56620+
type: object
5651256621
ObservabilityPipelineSplunkTcpSource:
5651356622
description: |-
5651456623
The `splunk_tcp` source receives logs from a Splunk Universal Forwarder over TCP.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2026-05-18T16:51:43.688Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"log": {
3+
"_recordingName": "Observability Pipelines/Validate an observability pipeline with HTTP server source valid_tokens returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "995eaf3b9758c2e80411db3be2ac2ed4",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 776,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 581,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"data\":{\"attributes\":{\"config\":{\"destinations\":[{\"id\":\"datadog-logs-destination\",\"inputs\":[\"my-processor-group\"],\"type\":\"datadog_logs\"}],\"processor_groups\":[{\"enabled\":true,\"id\":\"my-processor-group\",\"include\":\"service:my-service\",\"inputs\":[\"http-server-source\"],\"processors\":[{\"enabled\":true,\"id\":\"filter-processor\",\"include\":\"status:error\",\"type\":\"filter\"}]}],\"sources\":[{\"auth_strategy\":\"none\",\"decoding\":\"json\",\"id\":\"http-server-source\",\"type\":\"http_server\",\"valid_tokens\":[{\"enabled\":true,\"field_to_add\":{\"key\":\"token_name\",\"value\":\"primary_token\"},\"path_to_token\":{\"header\":\"X-Token\"},\"token_key\":\"HTTP_SERVER_TOKEN\"},{\"enabled\":true,\"path_to_token\":\"path\",\"token_key\":\"HTTP_SERVER_TOKEN_BACKUP\"}]}]},\"name\":\"Pipeline with HTTP server valid_tokens\"},\"type\":\"pipelines\"}}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v2/obs-pipelines/pipelines/validate"
39+
},
40+
"response": {
41+
"bodySize": 14,
42+
"content": {
43+
"mimeType": "application/vnd.api+json",
44+
"size": 14,
45+
"text": "{\"errors\":[]}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/vnd.api+json"
52+
}
53+
],
54+
"headersSize": 370,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2026-05-18T16:51:43.693Z",
61+
"time": 378
62+
}
63+
],
64+
"pages": [],
65+
"version": "1.2"
66+
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2026-05-18T16:51:43.307Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"log": {
3+
"_recordingName": "Observability Pipelines/Validate an observability pipeline with Splunk HEC source valid_tokens returns \"OK\" response",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "9683c2e56c7f303034c83c3f319a7454",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 670,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
},
23+
{
24+
"_fromType": "array",
25+
"name": "content-type",
26+
"value": "application/json"
27+
}
28+
],
29+
"headersSize": 581,
30+
"httpVersion": "HTTP/1.1",
31+
"method": "POST",
32+
"postData": {
33+
"mimeType": "application/json",
34+
"params": [],
35+
"text": "{\"data\":{\"attributes\":{\"config\":{\"destinations\":[{\"id\":\"datadog-logs-destination\",\"inputs\":[\"my-processor-group\"],\"type\":\"datadog_logs\"}],\"processor_groups\":[{\"enabled\":true,\"id\":\"my-processor-group\",\"include\":\"service:my-service\",\"inputs\":[\"splunk-hec-source\"],\"processors\":[{\"enabled\":true,\"id\":\"filter-processor\",\"include\":\"status:error\",\"type\":\"filter\"}]}],\"sources\":[{\"id\":\"splunk-hec-source\",\"type\":\"splunk_hec\",\"valid_tokens\":[{\"enabled\":true,\"field_to_add\":{\"key\":\"token_name\",\"value\":\"primary_token\"},\"token_key\":\"SPLUNK_HEC_TOKEN\"},{\"enabled\":false,\"token_key\":\"SPLUNK_HEC_TOKEN_BACKUP\"}]}]},\"name\":\"Pipeline with Splunk HEC valid_tokens\"},\"type\":\"pipelines\"}}"
36+
},
37+
"queryString": [],
38+
"url": "https://api.datadoghq.com/api/v2/obs-pipelines/pipelines/validate"
39+
},
40+
"response": {
41+
"bodySize": 14,
42+
"content": {
43+
"mimeType": "application/vnd.api+json",
44+
"size": 14,
45+
"text": "{\"errors\":[]}\n"
46+
},
47+
"cookies": [],
48+
"headers": [
49+
{
50+
"name": "content-type",
51+
"value": "application/vnd.api+json"
52+
}
53+
],
54+
"headersSize": 370,
55+
"httpVersion": "HTTP/1.1",
56+
"redirectURL": "",
57+
"status": 200,
58+
"statusText": "OK"
59+
},
60+
"startedDateTime": "2026-05-18T16:51:43.310Z",
61+
"time": 371
62+
}
63+
],
64+
"pages": [],
65+
"version": "1.2"
66+
}
67+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* Validate an observability pipeline with Splunk HEC source valid_tokens returns "OK" response
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.ObservabilityPipelinesApi(configuration);
9+
10+
const params: v2.ObservabilityPipelinesApiValidatePipelineRequest = {
11+
body: {
12+
data: {
13+
attributes: {
14+
config: {
15+
destinations: [
16+
{
17+
id: "datadog-logs-destination",
18+
inputs: ["my-processor-group"],
19+
type: "datadog_logs",
20+
},
21+
],
22+
processorGroups: [
23+
{
24+
enabled: true,
25+
id: "my-processor-group",
26+
include: "service:my-service",
27+
inputs: ["splunk-hec-source"],
28+
processors: [
29+
{
30+
enabled: true,
31+
id: "filter-processor",
32+
include: "status:error",
33+
type: "filter",
34+
},
35+
],
36+
},
37+
],
38+
sources: [
39+
{
40+
id: "splunk-hec-source",
41+
type: "splunk_hec",
42+
validTokens: [
43+
{
44+
tokenKey: "SPLUNK_HEC_TOKEN",
45+
enabled: true,
46+
fieldToAdd: {
47+
key: "token_name",
48+
value: "primary_token",
49+
},
50+
},
51+
{
52+
tokenKey: "SPLUNK_HEC_TOKEN_BACKUP",
53+
enabled: false,
54+
},
55+
],
56+
},
57+
],
58+
},
59+
name: "Pipeline with Splunk HEC valid_tokens",
60+
},
61+
type: "pipelines",
62+
},
63+
},
64+
};
65+
66+
apiInstance
67+
.validatePipeline(params)
68+
.then((data: v2.ValidationResponse) => {
69+
console.log(
70+
"API called successfully. Returned data: " + JSON.stringify(data)
71+
);
72+
})
73+
.catch((error: any) => console.error(error));

0 commit comments

Comments
 (0)