import requests
url = "https://api.platform.ankra.app/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 = {
"cookie": "ankra_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'ankra_session=', '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://api.platform.ankra.app/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://api.platform.ankra.app/org/clusters/imported/{cluster_id}/logs/query \
--header 'Content-Type: application/json' \
--cookie ankra_session= \
--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": {}
}Search cluster log history in the selected store
Session-authenticated historical search. Requires kubernetes.logs on this cluster. An explicit source never replaces a saved connection or changes shipping. Hosted reads remain pinned to the organisation and cluster.
import requests
url = "https://api.platform.ankra.app/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 = {
"cookie": "ankra_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'ankra_session=', '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://api.platform.ankra.app/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://api.platform.ankra.app/org/clusters/imported/{cluster_id}/logs/query \
--header 'Content-Type: application/json' \
--cookie ankra_session= \
--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
Browser session. Mutations also require X-Ankra-CSRF.
Path Parameters
Body
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.
auto, connected, ankra_hosted Also return each entry's record: the application's own structured line as stored, without the log shipper's envelope (Kubernetes metadata, stream, cluster and tenant fields). Elasticsearch/OpenSearch and VictoriaLogs only; long values are cut.
Response
Scoped log search results