Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-02 17:32:16.354936",
"spec_repo_commit": "733cf3ea"
"regenerated": "2025-01-03 15:57:06.622528",
"spec_repo_commit": "50c16e5f"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-02 17:32:16.370268",
"spec_repo_commit": "733cf3ea"
"regenerated": "2025-01-03 15:57:06.637357",
"spec_repo_commit": "50c16e5f"
}
}
}
8 changes: 4 additions & 4 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38621,7 +38621,7 @@ paths:
[Results are paginated][1].


Use this endpoint to see your latest logs.
Use this endpoint to search and filter your logs.


**If you are considering archiving logs for your organization,
Expand Down Expand Up @@ -38718,7 +38718,7 @@ paths:
$ref: '#/components/responses/NotAuthorizedResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Get a list of logs
summary: Search logs (GET)
tags:
- Logs
x-pagination:
Expand All @@ -38737,7 +38737,7 @@ paths:
[Results are paginated][1].


Use this endpoint to build complex logs filtering and search.
Use this endpoint to search and filter your logs.


**If you are considering archiving logs for your organization,
Expand Down Expand Up @@ -38770,7 +38770,7 @@ paths:
$ref: '#/components/responses/NotAuthorizedResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Search logs
summary: Search logs (POST)
tags:
- Logs
x-codegen-request-body-name: body
Expand Down
20 changes: 13 additions & 7 deletions examples/v2/logs/ListLogs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Search logs returns "OK" response
* Search logs (POST) returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";
Expand All @@ -10,15 +10,21 @@ const apiInstance = new v2.LogsApi(configuration);
const params: v2.LogsApiListLogsRequest = {
body: {
filter: {
query: "datadog-agent",
indexes: ["main"],
from: "2020-09-17T11:48:36+01:00",
to: "2020-09-17T12:48:36+01:00",
from: "now-15m",
indexes: ["main", "web"],
query: "service:web* AND @http.status_code:[200 TO 299]",
storageTier: "indexes",
to: "now",
},
options: {
timezone: "GMT",
},
sort: "timestamp",
page: {
limit: 5,
cursor:
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
limit: 25,
},
sort: "timestamp",
},
};

Expand Down
2 changes: 1 addition & 1 deletion examples/v2/logs/ListLogsGet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Get a list of logs returns "OK" response
* Search logs (GET) returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";
Expand Down
18 changes: 18 additions & 0 deletions examples/v2/logs/ListLogsGet_175182691.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Search logs (GET) returns "OK" response with pagination
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.LogsApi(configuration);

(async () => {
try {
for await (const item of apiInstance.listLogsGetWithPagination()) {
console.log(item);
}
} catch (error) {
console.error(error);
}
})();
32 changes: 32 additions & 0 deletions examples/v2/logs/ListLogs_3400928236.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Search logs returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.LogsApi(configuration);

const params: v2.LogsApiListLogsRequest = {
body: {
filter: {
query: "datadog-agent",
indexes: ["main"],
from: "2020-09-17T11:48:36+01:00",
to: "2020-09-17T12:48:36+01:00",
},
sort: "timestamp",
page: {
limit: 5,
},
},
};

apiInstance
.listLogs(params)
.then((data: v2.LogsListResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
39 changes: 39 additions & 0 deletions examples/v2/logs/ListLogs_534975433.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Search logs (POST) returns "OK" response with pagination
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.LogsApi(configuration);

const params: v2.LogsApiListLogsRequest = {
body: {
filter: {
from: "now-15m",
indexes: ["main", "web"],
query: "service:web* AND @http.status_code:[200 TO 299]",
storageTier: "indexes",
to: "now",
},
options: {
timezone: "GMT",
},
page: {
cursor:
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
limit: 25,
},
sort: "timestamp",
},
};

(async () => {
try {
for await (const item of apiInstance.listLogsWithPagination(params)) {
console.log(item);
}
} catch (error) {
console.error(error);
}
})();
53 changes: 38 additions & 15 deletions features/v2/logs.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,6 @@ Feature: Logs
Then the response status is 200 OK
And the response "meta.status" is equal to "done"

@generated @skip @team:DataDog/logs-app
Scenario: Get a list of logs returns "Bad Request" response
Given a valid "appKeyAuth" key in the system
And new "ListLogsGet" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/logs-app
Scenario: Get a list of logs returns "OK" response
Given a valid "appKeyAuth" key in the system
And new "ListLogsGet" request
When the request is sent
Then the response status is 200 OK

@replay-only @skip-validation @team:DataDog/logs-app @with-pagination
Scenario: Get a list of logs returns "OK" response with pagination
Given a valid "appKeyAuth" key in the system
Expand All @@ -80,13 +66,50 @@ Feature: Logs
And the response "data" has length 0

@generated @skip @team:DataDog/logs-app
Scenario: Search logs returns "Bad Request" response
Scenario: Search logs (GET) returns "Bad Request" response
Given a valid "appKeyAuth" key in the system
And new "ListLogsGet" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/logs-app
Scenario: Search logs (GET) returns "OK" response
Given a valid "appKeyAuth" key in the system
And new "ListLogsGet" request
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/logs-app @with-pagination
Scenario: Search logs (GET) returns "OK" response with pagination
Given a valid "appKeyAuth" key in the system
And new "ListLogsGet" request
When the request with pagination is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/logs-app
Scenario: Search logs (POST) returns "Bad Request" response
Given a valid "appKeyAuth" key in the system
And new "ListLogs" request
And body with value {"filter": {"from": "now-15m", "indexes": ["main", "web"], "query": "service:web* AND @http.status_code:[200 TO 299]", "storage_tier": "indexes", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "timestamp"}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/logs-app
Scenario: Search logs (POST) returns "OK" response
Given a valid "appKeyAuth" key in the system
And new "ListLogs" request
And body with value {"filter": {"from": "now-15m", "indexes": ["main", "web"], "query": "service:web* AND @http.status_code:[200 TO 299]", "storage_tier": "indexes", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "timestamp"}
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/logs-app @with-pagination
Scenario: Search logs (POST) returns "OK" response with pagination
Given a valid "appKeyAuth" key in the system
And new "ListLogs" request
And body with value {"filter": {"from": "now-15m", "indexes": ["main", "web"], "query": "service:web* AND @http.status_code:[200 TO 299]", "storage_tier": "indexes", "to": "now"}, "options": {"timezone": "GMT"}, "page": {"cursor": "eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==", "limit": 25}, "sort": "timestamp"}
When the request with pagination is sent
Then the response status is 200 OK

@team:DataDog/logs-app
Scenario: Search logs returns "OK" response
Given a valid "appKeyAuth" key in the system
Expand Down
4 changes: 2 additions & 2 deletions packages/datadog-api-client-v2/apis/LogsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ export class LogsApi {
* List endpoint returns logs that match a log search query.
* [Results are paginated][1].
*
* Use this endpoint to build complex logs filtering and search.
* Use this endpoint to search and filter your logs.
*
* **If you are considering archiving logs for your organization,
* consider use of the Datadog archive capabilities instead of the log list API.
Expand Down Expand Up @@ -713,7 +713,7 @@ export class LogsApi {
* List endpoint returns logs that match a log search query.
* [Results are paginated][1].
*
* Use this endpoint to see your latest logs.
* Use this endpoint to search and filter your logs.
*
* **If you are considering archiving logs for your organization,
* consider use of the Datadog archive capabilities instead of the log list API.
Expand Down
Loading