Search cluster log history in the selected store
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/query"
payload = {
"start": "<string>",
"end": "<string>",
"since": "<string>",
"search": "<string>",
"raw_query": "<string>",
"direction": "<string>",
"namespaces": ["<string>"],
"pods": ["<string>"],
"containers": ["<string>"],
"source": "auto",
"limit": 123,
"include_record": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start: '<string>',
end: '<string>',
since: '<string>',
search: '<string>',
raw_query: '<string>',
direction: '<string>',
namespaces: ['<string>'],
pods: ['<string>'],
containers: ['<string>'],
source: 'auto',
limit: 123,
include_record: false
})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start": "<string>",
"end": "<string>",
"since": "<string>",
"search": "<string>",
"raw_query": "<string>",
"direction": "<string>",
"namespaces": [
"<string>"
],
"pods": [
"<string>"
],
"containers": [
"<string>"
],
"source": "auto",
"limit": 123,
"include_record": false
}
'{
"provider": "<string>",
"source": "<string>",
"note": "<string>",
"entries": [
{
"timestamp": "<string>",
"line": "<string>",
"labels": {},
"record": {}
}
],
"total_hits": 123,
"total_hits_relation": "eq",
"truncated": true,
"start": "<string>",
"end": "<string>",
"cluster_attribution": {}
}Clusters
Search cluster log history in the selected store
Historical search of the cluster’s logs. An explicit source never replaces a saved connection or changes shipping. Hosted reads remain pinned to the organisation and cluster.
This is the API-token route. It requires kubernetes.logs on the cluster, and a token’s scopes narrow it.
POST
/
api
/
v1
/
org
/
clusters
/
imported
/
{cluster_id}
/
logs
/
query
Search cluster log history in the selected store
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/query"
payload = {
"start": "<string>",
"end": "<string>",
"since": "<string>",
"search": "<string>",
"raw_query": "<string>",
"direction": "<string>",
"namespaces": ["<string>"],
"pods": ["<string>"],
"containers": ["<string>"],
"source": "auto",
"limit": 123,
"include_record": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start: '<string>',
end: '<string>',
since: '<string>',
search: '<string>',
raw_query: '<string>',
direction: '<string>',
namespaces: ['<string>'],
pods: ['<string>'],
containers: ['<string>'],
source: 'auto',
limit: 123,
include_record: false
})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start": "<string>",
"end": "<string>",
"since": "<string>",
"search": "<string>",
"raw_query": "<string>",
"direction": "<string>",
"namespaces": [
"<string>"
],
"pods": [
"<string>"
],
"containers": [
"<string>"
],
"source": "auto",
"limit": 123,
"include_record": false
}
'{
"provider": "<string>",
"source": "<string>",
"note": "<string>",
"entries": [
{
"timestamp": "<string>",
"line": "<string>",
"labels": {},
"record": {}
}
],
"total_hits": 123,
"total_hits_relation": "eq",
"truncated": true,
"start": "<string>",
"end": "<string>",
"cluster_attribution": {}
}Authorizations
Body
application/json
Read auto (connected source first, hosted only when no source is connected), connected only, or Ankra hosted logs only. An explicit choice never switches on empty results or failure and does not alter the saved connection.
Available options:
auto, connected, ankra_hosted Response
Scoped log search results