collectDiagnostics
Start diagnostic collection
Initiates a new diagnostic collection process. This creates a collection job that gathers logs and diagnostics from specified namespaces and pods. The collection process runs asynchronously. Use the status endpoint to monitor progress. There is one current collection: each collect replaces the previous one, and the download builds its bundle from whichever collection is current. Pass the returned `collection_id` to the download so that it fails with 409 instead of serving a collection that replaced this one.
/api/v1/diagnostics/collect
Usage and SDK Samples
curl -X POST \
-H "Authorization: Bearer [[accessToken]]" \
-H "Accept: application/json,application/problem+json" \
-H "Content-Type: application/json" \
"/api/v1/diagnostics/api/v1/diagnostics/collect" \
-d '{
"live_resource_filters" : [ {
"environment" : "production",
"workload_type" : "deployment",
"workload_list" : [ "api-service" ]
}, {
"environment" : "production",
"workload_type" : "deployment",
"workload_list" : [ "api-service" ]
} ],
"end_timestamp" : "2025-02-10T23:59:59Z",
"start_timestamp" : "2025-02-10T00:00:00Z",
"archive_resource_filters" : [ {
"pod_list" : [ "executor-1", "driver-1" ],
"environment" : "production",
"namespace_list" : [ "spark-jobs", "cdp-system" ]
}, {
"pod_list" : [ "executor-1", "driver-1" ],
"environment" : "production",
"namespace_list" : [ "spark-jobs", "cdp-system" ]
} ],
"bundle_size" : 500,
"type" : "full",
"environment_filters" : [ {
"environment" : "production"
}, {
"environment" : "production"
} ]
}'
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.CollectionApi;
import java.io.File;
import java.util.*;
public class CollectionApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure Bearer (JWT) access token for authorization: JwtAuthentication
HttpBearerAuth JwtAuthentication = (HttpBearerAuth) defaultClient.getAuthentication("JwtAuthentication");
JwtAuthentication.setBearerToken("BEARER TOKEN");
// Create an instance of the API class
CollectionApi apiInstance = new CollectionApi();
CollectRequest collectRequest = {"type":"full","bundle_size":500,"start_timestamp":"2025-02-10T00:00:00Z","end_timestamp":"2025-02-10T23:59:59Z"}; // CollectRequest |
try {
CollectResponse result = apiInstance.collectDiagnostics(collectRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionApi#collectDiagnostics");
e.printStackTrace();
}
}
}
import 'package:openapi/api.dart';
final api_instance = DefaultApi();
final CollectRequest collectRequest = new CollectRequest(); // CollectRequest |
try {
final result = await api_instance.collectDiagnostics(collectRequest);
print(result);
} catch (e) {
print('Exception when calling DefaultApi->collectDiagnostics: $e\n');
}
import org.openapitools.client.api.CollectionApi;
public class CollectionApiExample {
public static void main(String[] args) {
CollectionApi apiInstance = new CollectionApi();
CollectRequest collectRequest = {"type":"full","bundle_size":500,"start_timestamp":"2025-02-10T00:00:00Z","end_timestamp":"2025-02-10T23:59:59Z"}; // CollectRequest |
try {
CollectResponse result = apiInstance.collectDiagnostics(collectRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CollectionApi#collectDiagnostics");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure Bearer (JWT) access token for authorization: JwtAuthentication
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
// Create an instance of the API class
CollectionApi *apiInstance = [[CollectionApi alloc] init];
CollectRequest *collectRequest = {"type":"full","bundle_size":500,"start_timestamp":"2025-02-10T00:00:00Z","end_timestamp":"2025-02-10T23:59:59Z"}; //
// Start diagnostic collection
[apiInstance collectDiagnosticsWith:collectRequest
completionHandler: ^(CollectResponse output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var AwcDiagnosticsServiceApi = require('awc_diagnostics_service_api');
var defaultClient = AwcDiagnosticsServiceApi.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: JwtAuthentication
var JwtAuthentication = defaultClient.authentications['JwtAuthentication'];
JwtAuthentication.accessToken = "YOUR ACCESS TOKEN";
// Create an instance of the API class
var api = new AwcDiagnosticsServiceApi.CollectionApi()
var collectRequest = {"type":"full","bundle_size":500,"start_timestamp":"2025-02-10T00:00:00Z","end_timestamp":"2025-02-10T23:59:59Z"}; // {CollectRequest}
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.collectDiagnostics(collectRequest, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class collectDiagnosticsExample
{
public void main()
{
// Configure Bearer (JWT) access token for authorization: JwtAuthentication
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
// Create an instance of the API class
var apiInstance = new CollectionApi();
var collectRequest = new CollectRequest(); // CollectRequest |
try {
// Start diagnostic collection
CollectResponse result = apiInstance.collectDiagnostics(collectRequest);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling CollectionApi.collectDiagnostics: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer (JWT) access token for authorization: JwtAuthentication
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setAccessToken('', 'YOUR_ACCESS_TOKEN');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\CollectionApi();
$collectRequest = {"type":"full","bundle_size":500,"start_timestamp":"2025-02-10T00:00:00Z","end_timestamp":"2025-02-10T23:59:59Z"}; // CollectRequest |
try {
$result = $api_instance->collectDiagnostics($collectRequest);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling CollectionApi->collectDiagnostics: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::CollectionApi;
# Configure Bearer (JWT) access token for authorization: JwtAuthentication
$WWW::OPenAPIClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::CollectionApi->new();
my $collectRequest = WWW::OPenAPIClient::Object::CollectRequest->new(); # CollectRequest |
eval {
my $result = $api_instance->collectDiagnostics(collectRequest => $collectRequest);
print Dumper($result);
};
if ($@) {
warn "Exception when calling CollectionApi->collectDiagnostics: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Configure Bearer (JWT) access token for authorization: JwtAuthentication
openapi_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Create an instance of the API class
api_instance = openapi_client.CollectionApi()
collectRequest = {"type":"full","bundle_size":500,"start_timestamp":"2025-02-10T00:00:00Z","end_timestamp":"2025-02-10T23:59:59Z"} # CollectRequest |
try:
# Start diagnostic collection
api_response = api_instance.collect_diagnostics(collectRequest)
pprint(api_response)
except ApiException as e:
print("Exception when calling CollectionApi->collectDiagnostics: %s\n" % e)
extern crate CollectionApi;
pub fn main() {
let collectRequest = {"type":"full","bundle_size":500,"start_timestamp":"2025-02-10T00:00:00Z","end_timestamp":"2025-02-10T23:59:59Z"}; // CollectRequest
let mut context = CollectionApi::Context::default();
let result = client.collectDiagnostics(collectRequest, &context).wait();
println!("{:?}", result);
}
Scopes
| manage_settings | HTTP Authorization Bearer header using a JWT |
Parameters
| Name | Description |
|---|---|
| collectRequest * |