Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 185 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6182,6 +6182,190 @@ components:
type: string
x-enum-varnames:
- ARITHMETIC_PROCESSOR
LogsArrayMapArithmeticSubProcessor:
description: |-
An arithmetic sub-processor for use inside an array-map processor.
Unlike the top-level arithmetic processor, `is_enabled` is not supported.
properties:
expression:
description: Arithmetic operation to perform.
example: ""
type: string
is_replace_missing:
default: false
description: Replace missing attribute values with 0.
type: boolean
name:
description: Name of the sub-processor.
type: string
target:
description: Target attribute path for the result.
example: ""
type: string
type:
$ref: "#/components/schemas/LogsArithmeticProcessorType"
required:
- expression
- target
- type
type: object
LogsArrayMapAttributeRemapper:
description: |-
An attribute remapper sub-processor for use inside an array-map processor.
Unlike the top-level attribute remapper, `is_enabled`, `source_type`, and
`target_type` are not supported.
properties:
name:
description: Name of the sub-processor.
type: string
override_on_conflict:
default: false
description: Override the target element if already set.
type: boolean
preserve_source:
default: false
description: Remove or preserve the remapped source element.
type: boolean
sources:
description: Array of source attribute paths.
example:
- ""
items:
type: string
type: array
target:
description: Target attribute path.
example: ""
type: string
target_format:
$ref: "#/components/schemas/TargetFormatType"
type:
$ref: "#/components/schemas/LogsAttributeRemapperType"
required:
- sources
- target
- type
type: object
LogsArrayMapCategorySubProcessor:
description: |-
A category sub-processor for use inside an array-map processor.
Unlike the top-level category processor, `is_enabled` is not supported.
properties:
categories:
description: Array of filters to match against a log and the corresponding value to assign.
items:
$ref: "#/components/schemas/LogsCategoryProcessorCategory"
type: array
name:
description: Name of the sub-processor.
type: string
target:
description: Target attribute path for the category value.
example: ""
type: string
type:
$ref: "#/components/schemas/LogsCategoryProcessorType"
required:
- categories
- target
- type
type: object
LogsArrayMapProcessor:
description: |-
The array-map processor transforms each element of a source array by applying
sub-processors in order and collecting the results into a target array.
Results can be written to a new array, to the source array (in-place), or to
an existing target array. Sub-processors can read from `$sourceElem.<field>`
(object element field), bare `$sourceElem` (primitive element), or any parent
log attribute path. Sub-processors write to `$targetElem.<field>` (object
output field) or bare `$targetElem` (primitive output).
properties:
is_enabled:
default: false
description: Whether or not the processor is enabled.
type: boolean
name:
description: Name of the processor.
type: string
preserve_source:
default: true
description: |-
When `false` and `source != target`, the source attribute is removed after
processing. Cannot be `false` when `source == target`.
type: boolean
processors:
description: |-
Sub-processors applied to each element. Allowed types: `attribute-remapper`,
`string-builder-processor`, `arithmetic-processor`, `category-processor`.
items:
$ref: "#/components/schemas/LogsArrayMapSubProcessor"
type: array
source:
description: |-
Attribute path of the source array. Elements are read-only via `$sourceElem`
inside sub-processors.
example: detail.resource.s3BucketDetails
type: string
target:
description: |-
Attribute path of the output array. Sub-processors write to `$targetElem`
(or `$targetElem.<field>`) to build each output element.
example: ocsf.resources
type: string
type:
$ref: "#/components/schemas/LogsArrayMapProcessorType"
required:
- source
- target
- processors
- type
type: object
LogsArrayMapProcessorType:
default: array-map-processor
description: Type of logs array-map processor.
enum:
- array-map-processor
example: array-map-processor
type: string
x-enum-varnames:
- ARRAY_MAP_PROCESSOR
LogsArrayMapStringBuilderSubProcessor:
description: |-
A string builder sub-processor for use inside an array-map processor.
Unlike the top-level string builder processor, `is_enabled` is not supported.
properties:
is_replace_missing:
default: false
description: Replace missing attribute values with an empty string.
type: boolean
name:
description: Name of the sub-processor.
type: string
target:
description: Target attribute path for the result.
example: ""
type: string
template:
description: Formula with one or more attributes and raw text.
example: ""
type: string
type:
$ref: "#/components/schemas/LogsStringBuilderProcessorType"
required:
- template
- target
- type
type: object
LogsArrayMapSubProcessor:
description: |-
A sub-processor used inside an array-map processor.
Allowed types: `attribute-remapper`, `string-builder-processor`,
`arithmetic-processor`, `category-processor`.
oneOf:
- $ref: "#/components/schemas/LogsArrayMapAttributeRemapper"
- $ref: "#/components/schemas/LogsArrayMapArithmeticSubProcessor"
- $ref: "#/components/schemas/LogsArrayMapStringBuilderSubProcessor"
- $ref: "#/components/schemas/LogsArrayMapCategorySubProcessor"
LogsArrayProcessor:
description: |-
A processor for extracting, aggregating, or transforming values from JSON arrays within your logs.
Expand Down Expand Up @@ -7237,6 +7421,7 @@ components:
- $ref: "#/components/schemas/LogsDecoderProcessor"
- $ref: "#/components/schemas/LogsSchemaProcessor"
- $ref: "#/components/schemas/LogsExcludeAttributeProcessor"
- $ref: "#/components/schemas/LogsArrayMapProcessor"
LogsQueryCompute:
description: Define computation for a log query.
properties:
Expand Down
54 changes: 54 additions & 0 deletions examples/v1/logs-pipelines/CreateLogsPipeline_104735144.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Create a pipeline with Array Map Processor with preserve_source false returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsPipelinesApi;
import com.datadog.api.client.v1.model.LogsArrayMapAttributeRemapper;
import com.datadog.api.client.v1.model.LogsArrayMapProcessor;
import com.datadog.api.client.v1.model.LogsArrayMapProcessorType;
import com.datadog.api.client.v1.model.LogsArrayMapSubProcessor;
import com.datadog.api.client.v1.model.LogsAttributeRemapperType;
import com.datadog.api.client.v1.model.LogsFilter;
import com.datadog.api.client.v1.model.LogsPipeline;
import com.datadog.api.client.v1.model.LogsProcessor;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient);

LogsPipeline body =
new LogsPipeline()
.filter(new LogsFilter().query("source:python"))
.name("testPipelineArrayMapNoPreserve")
.processors(
Collections.singletonList(
new LogsProcessor(
new LogsArrayMapProcessor()
.type(LogsArrayMapProcessorType.ARRAY_MAP_PROCESSOR)
.isEnabled(true)
.name("map and remove source")
.source("items")
.target("out")
.preserveSource(false)
.processors(
Collections.singletonList(
new LogsArrayMapSubProcessor(
new LogsArrayMapAttributeRemapper()
.type(LogsAttributeRemapperType.ATTRIBUTE_REMAPPER)
.sources(Collections.singletonList("$sourceElem.id"))
.target("$targetElem.uid")))))));

try {
LogsPipeline result = apiInstance.createLogsPipeline(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
64 changes: 64 additions & 0 deletions examples/v1/logs-pipelines/CreateLogsPipeline_1185292896.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Create a pipeline with Array Map Processor using category sub-processor returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsPipelinesApi;
import com.datadog.api.client.v1.model.LogsArrayMapCategorySubProcessor;
import com.datadog.api.client.v1.model.LogsArrayMapProcessor;
import com.datadog.api.client.v1.model.LogsArrayMapProcessorType;
import com.datadog.api.client.v1.model.LogsArrayMapSubProcessor;
import com.datadog.api.client.v1.model.LogsCategoryProcessorCategory;
import com.datadog.api.client.v1.model.LogsCategoryProcessorType;
import com.datadog.api.client.v1.model.LogsFilter;
import com.datadog.api.client.v1.model.LogsPipeline;
import com.datadog.api.client.v1.model.LogsProcessor;
import java.util.Arrays;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient);

LogsPipeline body =
new LogsPipeline()
.filter(new LogsFilter().query("source:python"))
.name("testPipelineArrayMapCategory")
.processors(
Collections.singletonList(
new LogsProcessor(
new LogsArrayMapProcessor()
.type(LogsArrayMapProcessorType.ARRAY_MAP_PROCESSOR)
.isEnabled(true)
.name("categorize items")
.source("items")
.target("out")
.processors(
Collections.singletonList(
new LogsArrayMapSubProcessor(
new LogsArrayMapCategorySubProcessor()
.type(LogsCategoryProcessorType.CATEGORY_PROCESSOR)
.target("$targetElem.level")
.categories(
Arrays.asList(
new LogsCategoryProcessorCategory()
.filter(
new LogsFilter()
.query("@$sourceElem.status:error"))
.name("error"),
new LogsCategoryProcessorCategory()
.filter(new LogsFilter().query("*"))
.name("info")))))))));

try {
LogsPipeline result = apiInstance.createLogsPipeline(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
53 changes: 53 additions & 0 deletions examples/v1/logs-pipelines/CreateLogsPipeline_2402034476.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Create a pipeline with Array Map Processor using arithmetic sub-processor returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.LogsPipelinesApi;
import com.datadog.api.client.v1.model.LogsArithmeticProcessorType;
import com.datadog.api.client.v1.model.LogsArrayMapArithmeticSubProcessor;
import com.datadog.api.client.v1.model.LogsArrayMapProcessor;
import com.datadog.api.client.v1.model.LogsArrayMapProcessorType;
import com.datadog.api.client.v1.model.LogsArrayMapSubProcessor;
import com.datadog.api.client.v1.model.LogsFilter;
import com.datadog.api.client.v1.model.LogsPipeline;
import com.datadog.api.client.v1.model.LogsProcessor;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
LogsPipelinesApi apiInstance = new LogsPipelinesApi(defaultClient);

LogsPipeline body =
new LogsPipeline()
.filter(new LogsFilter().query("source:python"))
.name("testPipelineArrayMapArithmetic")
.processors(
Collections.singletonList(
new LogsProcessor(
new LogsArrayMapProcessor()
.type(LogsArrayMapProcessorType.ARRAY_MAP_PROCESSOR)
.isEnabled(true)
.name("double counts")
.source("items")
.target("out")
.processors(
Collections.singletonList(
new LogsArrayMapSubProcessor(
new LogsArrayMapArithmeticSubProcessor()
.type(LogsArithmeticProcessorType.ARITHMETIC_PROCESSOR)
.expression("$sourceElem.count * 2")
.target("$targetElem.doubled")))))));

try {
LogsPipeline result = apiInstance.createLogsPipeline(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LogsPipelinesApi#createLogsPipeline");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Loading
Loading