Skip to content

Commit b98636c

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add support for Array Processor in Logs Pipelines (#2952)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 3e6fe9a commit b98636c

File tree

28 files changed

+2360
-8
lines changed

28 files changed

+2360
-8
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-07-02 20:43:23.766576",
8-
"spec_repo_commit": "e327e6df"
7+
"regenerated": "2025-07-03 15:49:18.544006",
8+
"spec_repo_commit": "d781944f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-07-02 20:43:23.783767",
13-
"spec_repo_commit": "e327e6df"
12+
"regenerated": "2025-07-03 15:49:18.560297",
13+
"spec_repo_commit": "d781944f"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5163,6 +5163,143 @@ components:
51635163
type: string
51645164
x-enum-varnames:
51655165
- ARITHMETIC_PROCESSOR
5166+
LogsArrayProcessor:
5167+
description: 'A processor for extracting, aggregating, or transforming values
5168+
from JSON arrays within your logs.
5169+
5170+
Supported operations are:
5171+
5172+
- Select value from matching element
5173+
5174+
- Compute array length
5175+
5176+
- Append a value to an array'
5177+
properties:
5178+
is_enabled:
5179+
default: false
5180+
description: Whether or not the processor is enabled.
5181+
type: boolean
5182+
name:
5183+
description: Name of the processor.
5184+
type: string
5185+
operation:
5186+
$ref: '#/components/schemas/LogsArrayProcessorOperation'
5187+
type:
5188+
$ref: '#/components/schemas/LogsArrayProcessorType'
5189+
required:
5190+
- operation
5191+
- type
5192+
type: object
5193+
LogsArrayProcessorOperation:
5194+
description: Configuration of the array processor operation to perform.
5195+
oneOf:
5196+
- $ref: '#/components/schemas/LogsArrayProcessorOperationAppend'
5197+
- $ref: '#/components/schemas/LogsArrayProcessorOperationLength'
5198+
- $ref: '#/components/schemas/LogsArrayProcessorOperationSelect'
5199+
LogsArrayProcessorOperationAppend:
5200+
description: Operation that appends a value to a target array attribute.
5201+
properties:
5202+
preserve_source:
5203+
default: true
5204+
description: Remove or preserve the remapped source element.
5205+
type: boolean
5206+
source:
5207+
description: Attribute path containing the value to append.
5208+
example: network.client.ip
5209+
type: string
5210+
target:
5211+
description: Attribute path of the array to append to.
5212+
example: sourceIps
5213+
type: string
5214+
type:
5215+
$ref: '#/components/schemas/LogsArrayProcessorOperationAppendType'
5216+
required:
5217+
- type
5218+
- source
5219+
- target
5220+
type: object
5221+
LogsArrayProcessorOperationAppendType:
5222+
description: Operation type.
5223+
enum:
5224+
- append
5225+
example: append
5226+
type: string
5227+
x-enum-varnames:
5228+
- APPEND
5229+
LogsArrayProcessorOperationLength:
5230+
description: Operation that computes the length of a `source` array and stores
5231+
the result in the `target` attribute.
5232+
properties:
5233+
source:
5234+
description: Attribute path of the array to measure.
5235+
example: tags
5236+
type: string
5237+
target:
5238+
description: Attribute that receives the computed length.
5239+
example: tagCount
5240+
type: string
5241+
type:
5242+
$ref: '#/components/schemas/LogsArrayProcessorOperationLengthType'
5243+
required:
5244+
- type
5245+
- source
5246+
- target
5247+
type: object
5248+
LogsArrayProcessorOperationLengthType:
5249+
description: Operation type.
5250+
enum:
5251+
- length
5252+
example: length
5253+
type: string
5254+
x-enum-varnames:
5255+
- LENGTH
5256+
LogsArrayProcessorOperationSelect:
5257+
description: Operation that finds an object in a `source` array using a `filter`,
5258+
and then extracts a specific value into the `target` attribute.
5259+
properties:
5260+
filter:
5261+
description: Filter condition expressed as `key:value` used to find the
5262+
matching element.
5263+
example: name:Referrer
5264+
type: string
5265+
source:
5266+
description: Attribute path of the array to search into.
5267+
example: httpRequest.headers
5268+
type: string
5269+
target:
5270+
description: Attribute that receives the extracted value.
5271+
example: referrer
5272+
type: string
5273+
type:
5274+
$ref: '#/components/schemas/LogsArrayProcessorOperationSelectType'
5275+
value_to_extract:
5276+
description: Key of the value to extract from the matching element.
5277+
example: value
5278+
type: string
5279+
required:
5280+
- type
5281+
- source
5282+
- target
5283+
- filter
5284+
- value_to_extract
5285+
type: object
5286+
LogsArrayProcessorOperationSelectType:
5287+
description: Operation type.
5288+
enum:
5289+
- select
5290+
example: select
5291+
type: string
5292+
x-enum-varnames:
5293+
- SELECT
5294+
LogsArrayProcessorType:
5295+
default: array-processor
5296+
description: Type of logs array processor.
5297+
enum:
5298+
- array-processor
5299+
example: array-processor
5300+
type: string
5301+
x-enum-varnames:
5302+
- ARRAY_PROCESSOR
51665303
LogsAttributeRemapper:
51675304
description: 'The remapper processor remaps any source attribute(s) or tag to
51685305
another target attribute or tag.
@@ -6060,6 +6197,7 @@ components:
60606197
- $ref: '#/components/schemas/ReferenceTableLogsLookupProcessor'
60616198
- $ref: '#/components/schemas/LogsTraceRemapper'
60626199
- $ref: '#/components/schemas/LogsSpanRemapper'
6200+
- $ref: '#/components/schemas/LogsArrayProcessor'
60636201
LogsQueryCompute:
60646202
description: Define computation for a log query.
60656203
properties:
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Create a pipeline with Array Processor Append Operation returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v1.api.LogsPipelinesApi;
6+
import com.datadog.api.client.v1.model.LogsArrayProcessor;
7+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperation;
8+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperationAppend;
9+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperationAppendType;
10+
import com.datadog.api.client.v1.model.LogsArrayProcessorType;
11+
import com.datadog.api.client.v1.model.LogsFilter;
12+
import com.datadog.api.client.v1.model.LogsPipeline;
13+
import com.datadog.api.client.v1.model.LogsProcessor;
14+
import java.util.Collections;
15+
16+
public class Example {
17+
public static void main(String[] args) {
18+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
19+
LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient);
20+
21+
LogsPipeline body =
22+
new LogsPipeline()
23+
.filter(new LogsFilter().query("source:python"))
24+
.name("testPipelineArrayAppend")
25+
.processors(
26+
Collections.singletonList(
27+
new LogsProcessor(
28+
new LogsArrayProcessor()
29+
.type(LogsArrayProcessorType.ARRAY_PROCESSOR)
30+
.isEnabled(true)
31+
.name("append_ip_to_array")
32+
.operation(
33+
new LogsArrayProcessorOperation(
34+
new LogsArrayProcessorOperationAppend()
35+
.type(LogsArrayProcessorOperationAppendType.APPEND)
36+
.source("network.client.ip")
37+
.target("sourceIps"))))));
38+
39+
try {
40+
LogsPipeline result = apiInstance.createLogsPipeline(body);
41+
System.out.println(result);
42+
} catch (ApiException e) {
43+
System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline");
44+
System.err.println("Status code: " + e.getCode());
45+
System.err.println("Reason: " + e.getResponseBody());
46+
System.err.println("Response headers: " + e.getResponseHeaders());
47+
e.printStackTrace();
48+
}
49+
}
50+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Create a pipeline with Array Processor Select Operation returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v1.api.LogsPipelinesApi;
6+
import com.datadog.api.client.v1.model.LogsArrayProcessor;
7+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperation;
8+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperationSelect;
9+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperationSelectType;
10+
import com.datadog.api.client.v1.model.LogsArrayProcessorType;
11+
import com.datadog.api.client.v1.model.LogsFilter;
12+
import com.datadog.api.client.v1.model.LogsPipeline;
13+
import com.datadog.api.client.v1.model.LogsProcessor;
14+
import java.util.Collections;
15+
16+
public class Example {
17+
public static void main(String[] args) {
18+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
19+
LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient);
20+
21+
LogsPipeline body =
22+
new LogsPipeline()
23+
.filter(new LogsFilter().query("source:python"))
24+
.name("testPipelineArraySelect")
25+
.processors(
26+
Collections.singletonList(
27+
new LogsProcessor(
28+
new LogsArrayProcessor()
29+
.type(LogsArrayProcessorType.ARRAY_PROCESSOR)
30+
.isEnabled(true)
31+
.name("extract_referrer")
32+
.operation(
33+
new LogsArrayProcessorOperation(
34+
new LogsArrayProcessorOperationSelect()
35+
.type(LogsArrayProcessorOperationSelectType.SELECT)
36+
.source("httpRequest.headers")
37+
.target("referrer")
38+
.filter("name:Referrer")
39+
.valueToExtract("value"))))));
40+
41+
try {
42+
LogsPipeline result = apiInstance.createLogsPipeline(body);
43+
System.out.println(result);
44+
} catch (ApiException e) {
45+
System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline");
46+
System.err.println("Status code: " + e.getCode());
47+
System.err.println("Reason: " + e.getResponseBody());
48+
System.err.println("Response headers: " + e.getResponseHeaders());
49+
e.printStackTrace();
50+
}
51+
}
52+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Create a pipeline with Array Processor Length Operation returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v1.api.LogsPipelinesApi;
6+
import com.datadog.api.client.v1.model.LogsArrayProcessor;
7+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperation;
8+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperationLength;
9+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperationLengthType;
10+
import com.datadog.api.client.v1.model.LogsArrayProcessorType;
11+
import com.datadog.api.client.v1.model.LogsFilter;
12+
import com.datadog.api.client.v1.model.LogsPipeline;
13+
import com.datadog.api.client.v1.model.LogsProcessor;
14+
import java.util.Collections;
15+
16+
public class Example {
17+
public static void main(String[] args) {
18+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
19+
LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient);
20+
21+
LogsPipeline body =
22+
new LogsPipeline()
23+
.filter(new LogsFilter().query("source:python"))
24+
.name("testPipelineArrayLength")
25+
.processors(
26+
Collections.singletonList(
27+
new LogsProcessor(
28+
new LogsArrayProcessor()
29+
.type(LogsArrayProcessorType.ARRAY_PROCESSOR)
30+
.isEnabled(true)
31+
.name("count_tags")
32+
.operation(
33+
new LogsArrayProcessorOperation(
34+
new LogsArrayProcessorOperationLength()
35+
.type(LogsArrayProcessorOperationLengthType.LENGTH)
36+
.source("tags")
37+
.target("tagCount"))))));
38+
39+
try {
40+
LogsPipeline result = apiInstance.createLogsPipeline(body);
41+
System.out.println(result);
42+
} catch (ApiException e) {
43+
System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline");
44+
System.err.println("Status code: " + e.getCode());
45+
System.err.println("Reason: " + e.getResponseBody());
46+
System.err.println("Response headers: " + e.getResponseHeaders());
47+
e.printStackTrace();
48+
}
49+
}
50+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Create a pipeline with Array Processor Append Operation with preserve_source true returns "OK"
2+
// response
3+
4+
import com.datadog.api.client.ApiClient;
5+
import com.datadog.api.client.ApiException;
6+
import com.datadog.api.client.v1.api.LogsPipelinesApi;
7+
import com.datadog.api.client.v1.model.LogsArrayProcessor;
8+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperation;
9+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperationAppend;
10+
import com.datadog.api.client.v1.model.LogsArrayProcessorOperationAppendType;
11+
import com.datadog.api.client.v1.model.LogsArrayProcessorType;
12+
import com.datadog.api.client.v1.model.LogsFilter;
13+
import com.datadog.api.client.v1.model.LogsPipeline;
14+
import com.datadog.api.client.v1.model.LogsProcessor;
15+
import java.util.Collections;
16+
17+
public class Example {
18+
public static void main(String[] args) {
19+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
20+
LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient);
21+
22+
LogsPipeline body =
23+
new LogsPipeline()
24+
.filter(new LogsFilter().query("source:python"))
25+
.name("testPipelineArrayAppendPreserve")
26+
.processors(
27+
Collections.singletonList(
28+
new LogsProcessor(
29+
new LogsArrayProcessor()
30+
.type(LogsArrayProcessorType.ARRAY_PROCESSOR)
31+
.isEnabled(true)
32+
.name("append_ip_and_keep_source")
33+
.operation(
34+
new LogsArrayProcessorOperation(
35+
new LogsArrayProcessorOperationAppend()
36+
.type(LogsArrayProcessorOperationAppendType.APPEND)
37+
.source("network.client.ip")
38+
.target("sourceIps")
39+
.preserveSource(true))))));
40+
41+
try {
42+
LogsPipeline result = apiInstance.createLogsPipeline(body);
43+
System.out.println(result);
44+
} catch (ApiException e) {
45+
System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline");
46+
System.err.println("Status code: " + e.getCode());
47+
System.err.println("Reason: " + e.getResponseBody());
48+
System.err.println("Response headers: " + e.getResponseHeaders());
49+
e.printStackTrace();
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)