Skip to content

Commit 229b782

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update header for logs search endpoints (#1980)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 3606758 commit 229b782

File tree

9 files changed

+151
-33
lines changed

9 files changed

+151
-33
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-01-02 17:32:16.354936",
8-
"spec_repo_commit": "733cf3ea"
7+
"regenerated": "2025-01-03 15:57:06.622528",
8+
"spec_repo_commit": "50c16e5f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-02 17:32:16.370268",
13-
"spec_repo_commit": "733cf3ea"
12+
"regenerated": "2025-01-03 15:57:06.637357",
13+
"spec_repo_commit": "50c16e5f"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38621,7 +38621,7 @@ paths:
3862138621
[Results are paginated][1].
3862238622

3862338623

38624-
Use this endpoint to see your latest logs.
38624+
Use this endpoint to search and filter your logs.
3862538625

3862638626

3862738627
**If you are considering archiving logs for your organization,
@@ -38718,7 +38718,7 @@ paths:
3871838718
$ref: '#/components/responses/NotAuthorizedResponse'
3871938719
'429':
3872038720
$ref: '#/components/responses/TooManyRequestsResponse'
38721-
summary: Get a list of logs
38721+
summary: Search logs (GET)
3872238722
tags:
3872338723
- Logs
3872438724
x-pagination:
@@ -38737,7 +38737,7 @@ paths:
3873738737
[Results are paginated][1].
3873838738

3873938739

38740-
Use this endpoint to build complex logs filtering and search.
38740+
Use this endpoint to search and filter your logs.
3874138741

3874238742

3874338743
**If you are considering archiving logs for your organization,
@@ -38770,7 +38770,7 @@ paths:
3877038770
$ref: '#/components/responses/NotAuthorizedResponse'
3877138771
'429':
3877238772
$ref: '#/components/responses/TooManyRequestsResponse'
38773-
summary: Search logs
38773+
summary: Search logs (POST)
3877438774
tags:
3877538775
- Logs
3877638776
x-codegen-request-body-name: body

examples/v2/logs/ListLogs.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Search logs returns "OK" response
2+
* Search logs (POST) returns "OK" response
33
*/
44

55
import { client, v2 } from "@datadog/datadog-api-client";
@@ -10,15 +10,21 @@ const apiInstance = new v2.LogsApi(configuration);
1010
const params: v2.LogsApiListLogsRequest = {
1111
body: {
1212
filter: {
13-
query: "datadog-agent",
14-
indexes: ["main"],
15-
from: "2020-09-17T11:48:36+01:00",
16-
to: "2020-09-17T12:48:36+01:00",
13+
from: "now-15m",
14+
indexes: ["main", "web"],
15+
query: "service:web* AND @http.status_code:[200 TO 299]",
16+
storageTier: "indexes",
17+
to: "now",
18+
},
19+
options: {
20+
timezone: "GMT",
1721
},
18-
sort: "timestamp",
1922
page: {
20-
limit: 5,
23+
cursor:
24+
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
25+
limit: 25,
2126
},
27+
sort: "timestamp",
2228
},
2329
};
2430

examples/v2/logs/ListLogsGet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Get a list of logs returns "OK" response
2+
* Search logs (GET) returns "OK" response
33
*/
44

55
import { client, v2 } from "@datadog/datadog-api-client";
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Search logs (GET) returns "OK" response with pagination
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.LogsApi(configuration);
9+
10+
(async () => {
11+
try {
12+
for await (const item of apiInstance.listLogsGetWithPagination()) {
13+
console.log(item);
14+
}
15+
} catch (error) {
16+
console.error(error);
17+
}
18+
})();
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Search logs 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.LogsApi(configuration);
9+
10+
const params: v2.LogsApiListLogsRequest = {
11+
body: {
12+
filter: {
13+
query: "datadog-agent",
14+
indexes: ["main"],
15+
from: "2020-09-17T11:48:36+01:00",
16+
to: "2020-09-17T12:48:36+01:00",
17+
},
18+
sort: "timestamp",
19+
page: {
20+
limit: 5,
21+
},
22+
},
23+
};
24+
25+
apiInstance
26+
.listLogs(params)
27+
.then((data: v2.LogsListResponse) => {
28+
console.log(
29+
"API called successfully. Returned data: " + JSON.stringify(data)
30+
);
31+
})
32+
.catch((error: any) => console.error(error));
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* Search logs (POST) returns "OK" response with pagination
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v2.LogsApi(configuration);
9+
10+
const params: v2.LogsApiListLogsRequest = {
11+
body: {
12+
filter: {
13+
from: "now-15m",
14+
indexes: ["main", "web"],
15+
query: "service:web* AND @http.status_code:[200 TO 299]",
16+
storageTier: "indexes",
17+
to: "now",
18+
},
19+
options: {
20+
timezone: "GMT",
21+
},
22+
page: {
23+
cursor:
24+
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==",
25+
limit: 25,
26+
},
27+
sort: "timestamp",
28+
},
29+
};
30+
31+
(async () => {
32+
try {
33+
for await (const item of apiInstance.listLogsWithPagination(params)) {
34+
console.log(item);
35+
}
36+
} catch (error) {
37+
console.error(error);
38+
}
39+
})();

features/v2/logs.feature

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,6 @@ Feature: Logs
4343
Then the response status is 200 OK
4444
And the response "meta.status" is equal to "done"
4545

46-
@generated @skip @team:DataDog/logs-app
47-
Scenario: Get a list of logs returns "Bad Request" response
48-
Given a valid "appKeyAuth" key in the system
49-
And new "ListLogsGet" request
50-
When the request is sent
51-
Then the response status is 400 Bad Request
52-
53-
@generated @skip @team:DataDog/logs-app
54-
Scenario: Get a list of logs returns "OK" response
55-
Given a valid "appKeyAuth" key in the system
56-
And new "ListLogsGet" request
57-
When the request is sent
58-
Then the response status is 200 OK
59-
6046
@replay-only @skip-validation @team:DataDog/logs-app @with-pagination
6147
Scenario: Get a list of logs returns "OK" response with pagination
6248
Given a valid "appKeyAuth" key in the system
@@ -80,13 +66,50 @@ Feature: Logs
8066
And the response "data" has length 0
8167

8268
@generated @skip @team:DataDog/logs-app
83-
Scenario: Search logs returns "Bad Request" response
69+
Scenario: Search logs (GET) returns "Bad Request" response
70+
Given a valid "appKeyAuth" key in the system
71+
And new "ListLogsGet" request
72+
When the request is sent
73+
Then the response status is 400 Bad Request
74+
75+
@generated @skip @team:DataDog/logs-app
76+
Scenario: Search logs (GET) returns "OK" response
77+
Given a valid "appKeyAuth" key in the system
78+
And new "ListLogsGet" request
79+
When the request is sent
80+
Then the response status is 200 OK
81+
82+
@generated @skip @team:DataDog/logs-app @with-pagination
83+
Scenario: Search logs (GET) returns "OK" response with pagination
84+
Given a valid "appKeyAuth" key in the system
85+
And new "ListLogsGet" request
86+
When the request with pagination is sent
87+
Then the response status is 200 OK
88+
89+
@generated @skip @team:DataDog/logs-app
90+
Scenario: Search logs (POST) returns "Bad Request" response
8491
Given a valid "appKeyAuth" key in the system
8592
And new "ListLogs" request
8693
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"}
8794
When the request is sent
8895
Then the response status is 400 Bad Request
8996

97+
@generated @skip @team:DataDog/logs-app
98+
Scenario: Search logs (POST) returns "OK" response
99+
Given a valid "appKeyAuth" key in the system
100+
And new "ListLogs" request
101+
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"}
102+
When the request is sent
103+
Then the response status is 200 OK
104+
105+
@generated @skip @team:DataDog/logs-app @with-pagination
106+
Scenario: Search logs (POST) returns "OK" response with pagination
107+
Given a valid "appKeyAuth" key in the system
108+
And new "ListLogs" request
109+
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"}
110+
When the request with pagination is sent
111+
Then the response status is 200 OK
112+
90113
@team:DataDog/logs-app
91114
Scenario: Search logs returns "OK" response
92115
Given a valid "appKeyAuth" key in the system

packages/datadog-api-client-v2/apis/LogsApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ export class LogsApi {
626626
* List endpoint returns logs that match a log search query.
627627
* [Results are paginated][1].
628628
*
629-
* Use this endpoint to build complex logs filtering and search.
629+
* Use this endpoint to search and filter your logs.
630630
*
631631
* **If you are considering archiving logs for your organization,
632632
* consider use of the Datadog archive capabilities instead of the log list API.
@@ -713,7 +713,7 @@ export class LogsApi {
713713
* List endpoint returns logs that match a log search query.
714714
* [Results are paginated][1].
715715
*
716-
* Use this endpoint to see your latest logs.
716+
* Use this endpoint to search and filter your logs.
717717
*
718718
* **If you are considering archiving logs for your organization,
719719
* consider use of the Datadog archive capabilities instead of the log list API.

0 commit comments

Comments
 (0)