Skip to content

Commit b20595c

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Update header for logs search endpoints (#2637)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 58c4d71 commit b20595c

File tree

9 files changed

+196
-48
lines changed

9 files changed

+196
-48
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:09.022655",
8-
"spec_repo_commit": "733cf3ea"
7+
"regenerated": "2025-01-03 15:57:07.358573",
8+
"spec_repo_commit": "50c16e5f"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-01-02 17:32:09.037464",
13-
"spec_repo_commit": "733cf3ea"
12+
"regenerated": "2025-01-03 15:57:07.373454",
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.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Search logs returns "OK" response
1+
// Search logs (POST) returns "OK" response
22

33
import com.datadog.api.client.ApiClient;
44
import com.datadog.api.client.ApiException;
@@ -8,8 +8,10 @@
88
import com.datadog.api.client.v2.model.LogsListRequestPage;
99
import com.datadog.api.client.v2.model.LogsListResponse;
1010
import com.datadog.api.client.v2.model.LogsQueryFilter;
11+
import com.datadog.api.client.v2.model.LogsQueryOptions;
1112
import com.datadog.api.client.v2.model.LogsSort;
12-
import java.util.Collections;
13+
import com.datadog.api.client.v2.model.LogsStorageTier;
14+
import java.util.Arrays;
1315

1416
public class Example {
1517
public static void main(String[] args) {
@@ -20,12 +22,18 @@ public static void main(String[] args) {
2022
new LogsListRequest()
2123
.filter(
2224
new LogsQueryFilter()
23-
.query("datadog-agent")
24-
.indexes(Collections.singletonList("main"))
25-
.from("2020-09-17T11:48:36+01:00")
26-
.to("2020-09-17T12:48:36+01:00"))
27-
.sort(LogsSort.TIMESTAMP_ASCENDING)
28-
.page(new LogsListRequestPage().limit(5));
25+
.from("now-15m")
26+
.indexes(Arrays.asList("main", "web"))
27+
.query("service:web* AND @http.status_code:[200 TO 299]")
28+
.storageTier(LogsStorageTier.INDEXES)
29+
.to("now"))
30+
.options(new LogsQueryOptions().timezone("GMT"))
31+
.page(
32+
new LogsListRequestPage()
33+
.cursor(
34+
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==")
35+
.limit(25))
36+
.sort(LogsSort.TIMESTAMP_ASCENDING);
2937

3038
try {
3139
LogsListResponse result = apiInstance.listLogs(new ListLogsOptionalParameters().body(body));

examples/v2/logs/ListLogsGet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Get a list of logs returns "OK" response
1+
// Search logs (GET) returns "OK" response
22

33
import com.datadog.api.client.ApiClient;
44
import com.datadog.api.client.ApiException;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Search logs (GET) returns "OK" response with pagination
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.PaginationIterable;
5+
import com.datadog.api.client.v2.api.LogsApi;
6+
import com.datadog.api.client.v2.model.Log;
7+
8+
public class Example {
9+
public static void main(String[] args) {
10+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
11+
LogsApi apiInstance = new LogsApi(defaultClient);
12+
13+
try {
14+
PaginationIterable<Log> iterable = apiInstance.listLogsGetWithPagination();
15+
16+
for (Log item : iterable) {
17+
System.out.println(item);
18+
}
19+
} catch (RuntimeException e) {
20+
System.err.println("Exception when calling LogsApi#listLogsGetWithPagination");
21+
System.err.println("Reason: " + e.getMessage());
22+
e.printStackTrace();
23+
}
24+
}
25+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Search logs returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.LogsApi;
6+
import com.datadog.api.client.v2.api.LogsApi.ListLogsOptionalParameters;
7+
import com.datadog.api.client.v2.model.LogsListRequest;
8+
import com.datadog.api.client.v2.model.LogsListRequestPage;
9+
import com.datadog.api.client.v2.model.LogsListResponse;
10+
import com.datadog.api.client.v2.model.LogsQueryFilter;
11+
import com.datadog.api.client.v2.model.LogsSort;
12+
import java.util.Collections;
13+
14+
public class Example {
15+
public static void main(String[] args) {
16+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
17+
LogsApi apiInstance = new LogsApi(defaultClient);
18+
19+
LogsListRequest body =
20+
new LogsListRequest()
21+
.filter(
22+
new LogsQueryFilter()
23+
.query("datadog-agent")
24+
.indexes(Collections.singletonList("main"))
25+
.from("2020-09-17T11:48:36+01:00")
26+
.to("2020-09-17T12:48:36+01:00"))
27+
.sort(LogsSort.TIMESTAMP_ASCENDING)
28+
.page(new LogsListRequestPage().limit(5));
29+
30+
try {
31+
LogsListResponse result = apiInstance.listLogs(new ListLogsOptionalParameters().body(body));
32+
System.out.println(result);
33+
} catch (ApiException e) {
34+
System.err.println("Exception when calling LogsApi#listLogs");
35+
System.err.println("Status code: " + e.getCode());
36+
System.err.println("Reason: " + e.getResponseBody());
37+
System.err.println("Response headers: " + e.getResponseHeaders());
38+
e.printStackTrace();
39+
}
40+
}
41+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Search logs (POST) returns "OK" response with pagination
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.PaginationIterable;
5+
import com.datadog.api.client.v2.api.LogsApi;
6+
import com.datadog.api.client.v2.api.LogsApi.ListLogsOptionalParameters;
7+
import com.datadog.api.client.v2.model.Log;
8+
import com.datadog.api.client.v2.model.LogsListRequest;
9+
import com.datadog.api.client.v2.model.LogsListRequestPage;
10+
import com.datadog.api.client.v2.model.LogsQueryFilter;
11+
import com.datadog.api.client.v2.model.LogsQueryOptions;
12+
import com.datadog.api.client.v2.model.LogsSort;
13+
import com.datadog.api.client.v2.model.LogsStorageTier;
14+
import java.util.Arrays;
15+
16+
public class Example {
17+
public static void main(String[] args) {
18+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
19+
LogsApi apiInstance = new LogsApi(defaultClient);
20+
21+
LogsListRequest body =
22+
new LogsListRequest()
23+
.filter(
24+
new LogsQueryFilter()
25+
.from("now-15m")
26+
.indexes(Arrays.asList("main", "web"))
27+
.query("service:web* AND @http.status_code:[200 TO 299]")
28+
.storageTier(LogsStorageTier.INDEXES)
29+
.to("now"))
30+
.options(new LogsQueryOptions().timezone("GMT"))
31+
.page(
32+
new LogsListRequestPage()
33+
.cursor(
34+
"eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ==")
35+
.limit(25))
36+
.sort(LogsSort.TIMESTAMP_ASCENDING);
37+
38+
try {
39+
PaginationIterable<Log> iterable =
40+
apiInstance.listLogsWithPagination(new ListLogsOptionalParameters().body(body));
41+
42+
for (Log item : iterable) {
43+
System.out.println(item);
44+
}
45+
} catch (RuntimeException e) {
46+
System.err.println("Exception when calling LogsApi#listLogsWithPagination");
47+
System.err.println("Reason: " + e.getMessage());
48+
e.printStackTrace();
49+
}
50+
}
51+
}

src/main/java/com/datadog/api/client/v2/api/LogsApi.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public ListLogsOptionalParameters body(LogsListRequest body) {
204204
}
205205

206206
/**
207-
* Search logs.
207+
* Search logs (POST).
208208
*
209209
* <p>See {@link #listLogsWithHttpInfo}.
210210
*
@@ -216,7 +216,7 @@ public LogsListResponse listLogs() throws ApiException {
216216
}
217217

218218
/**
219-
* Search logs.
219+
* Search logs (POST).
220220
*
221221
* <p>See {@link #listLogsWithHttpInfoAsync}.
222222
*
@@ -231,7 +231,7 @@ public CompletableFuture<LogsListResponse> listLogsAsync() {
231231
}
232232

233233
/**
234-
* Search logs.
234+
* Search logs (POST).
235235
*
236236
* <p>See {@link #listLogsWithHttpInfo}.
237237
*
@@ -244,7 +244,7 @@ public LogsListResponse listLogs(ListLogsOptionalParameters parameters) throws A
244244
}
245245

246246
/**
247-
* Search logs.
247+
* Search logs (POST).
248248
*
249249
* <p>See {@link #listLogsWithHttpInfoAsync}.
250250
*
@@ -260,7 +260,7 @@ public CompletableFuture<LogsListResponse> listLogsAsync(ListLogsOptionalParamet
260260
}
261261

262262
/**
263-
* Search logs.
263+
* Search logs (POST).
264264
*
265265
* <p>See {@link #listLogsWithHttpInfo}.
266266
*
@@ -272,7 +272,7 @@ public PaginationIterable<Log> listLogsWithPagination() {
272272
}
273273

274274
/**
275-
* Search logs.
275+
* Search logs (POST).
276276
*
277277
* <p>See {@link #listLogsWithHttpInfo}.
278278
*
@@ -322,7 +322,7 @@ public PaginationIterable<Log> listLogsWithPagination(ListLogsOptionalParameters
322322
* List endpoint returns logs that match a log search query. <a
323323
* href="/logs/guide/collect-multiple-logs-with-pagination">Results are paginated</a>.
324324
*
325-
* <p>Use this endpoint to build complex logs filtering and search.
325+
* <p>Use this endpoint to search and filter your logs.
326326
*
327327
* <p><strong>If you are considering archiving logs for your organization, consider use of the
328328
* Datadog archive capabilities instead of the log list API. See <a
@@ -371,7 +371,7 @@ public ApiResponse<LogsListResponse> listLogsWithHttpInfo(ListLogsOptionalParame
371371
}
372372

373373
/**
374-
* Search logs.
374+
* Search logs (POST).
375375
*
376376
* <p>See {@link #listLogsWithHttpInfo}.
377377
*
@@ -517,7 +517,7 @@ public ListLogsGetOptionalParameters pageLimit(Integer pageLimit) {
517517
}
518518

519519
/**
520-
* Get a list of logs.
520+
* Search logs (GET).
521521
*
522522
* <p>See {@link #listLogsGetWithHttpInfo}.
523523
*
@@ -529,7 +529,7 @@ public LogsListResponse listLogsGet() throws ApiException {
529529
}
530530

531531
/**
532-
* Get a list of logs.
532+
* Search logs (GET).
533533
*
534534
* <p>See {@link #listLogsGetWithHttpInfoAsync}.
535535
*
@@ -544,7 +544,7 @@ public CompletableFuture<LogsListResponse> listLogsGetAsync() {
544544
}
545545

546546
/**
547-
* Get a list of logs.
547+
* Search logs (GET).
548548
*
549549
* <p>See {@link #listLogsGetWithHttpInfo}.
550550
*
@@ -558,7 +558,7 @@ public LogsListResponse listLogsGet(ListLogsGetOptionalParameters parameters)
558558
}
559559

560560
/**
561-
* Get a list of logs.
561+
* Search logs (GET).
562562
*
563563
* <p>See {@link #listLogsGetWithHttpInfoAsync}.
564564
*
@@ -575,7 +575,7 @@ public CompletableFuture<LogsListResponse> listLogsGetAsync(
575575
}
576576

577577
/**
578-
* Get a list of logs.
578+
* Search logs (GET).
579579
*
580580
* <p>See {@link #listLogsGetWithHttpInfo}.
581581
*
@@ -587,7 +587,7 @@ public PaginationIterable<Log> listLogsGetWithPagination() {
587587
}
588588

589589
/**
590-
* Get a list of logs.
590+
* Search logs (GET).
591591
*
592592
* <p>See {@link #listLogsGetWithHttpInfo}.
593593
*
@@ -630,7 +630,7 @@ public PaginationIterable<Log> listLogsGetWithPagination(
630630
* List endpoint returns logs that match a log search query. <a
631631
* href="/logs/guide/collect-multiple-logs-with-pagination">Results are paginated</a>.
632632
*
633-
* <p>Use this endpoint to see your latest logs.
633+
* <p>Use this endpoint to search and filter your logs.
634634
*
635635
* <p><strong>If you are considering archiving logs for your organization, consider use of the
636636
* Datadog archive capabilities instead of the log list API. See <a
@@ -698,7 +698,7 @@ public ApiResponse<LogsListResponse> listLogsGetWithHttpInfo(
698698
}
699699

700700
/**
701-
* Get a list of logs.
701+
* Search logs (GET).
702702
*
703703
* <p>See {@link #listLogsGetWithHttpInfo}.
704704
*

0 commit comments

Comments
 (0)