import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/fields"
payload = { "fields": ["<string>"] }
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({fields: ['<string>']})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/fields', 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/fields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fields": [
"<string>"
]
}
'{
"provider": "<string>",
"source": "<string>",
"note": "<string>",
"cluster_attribution": {},
"start": "<string>",
"end": "<string>",
"kept_days": 123,
"value_limit": 123,
"fields": [
{
"field": "<string>",
"state": "counted",
"reason": "hosted_line_is_text",
"note": "<string>",
"store_field": "<string>",
"values": [
{
"value": "<string>",
"count": 123
}
],
"value_limit": 123,
"values_capped": true,
"distinct_values": 123,
"lines_without_value": 123,
"counts_are_exact": true,
"own_filter_applied": true
}
]
}Count cluster log lines by field
The matching log lines of the window counted by each field asked for (level, pod, or a key of the application’s record), in the store the history query reads, with the same source choice and the log volume count’s filters. Level is counted by the log volume count’s rule. A field the store cannot group by is answered not_counted with a reason and a sentence, never as no values; a list cut at 100 values says so. A store that fails any field’s read answers an error, never fields without values.
This is the API-token route. It requires kubernetes.logs on the cluster, and a token’s scopes narrow it.
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/fields"
payload = { "fields": ["<string>"] }
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({fields: ['<string>']})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/fields', 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/fields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fields": [
"<string>"
]
}
'{
"provider": "<string>",
"source": "<string>",
"note": "<string>",
"cluster_attribution": {},
"start": "<string>",
"end": "<string>",
"kept_days": 123,
"value_limit": 123,
"fields": [
{
"field": "<string>",
"state": "counted",
"reason": "hosted_line_is_text",
"note": "<string>",
"store_field": "<string>",
"values": [
{
"value": "<string>",
"count": 123
}
],
"value_limit": 123,
"values_capped": true,
"distinct_values": 123,
"lines_without_value": 123,
"counts_are_exact": true,
"own_filter_applied": true
}
]
}Authorizations
Body
The fields to count, each once: level, pod, or record. for a key of the application's record (letters, digits, '_', '-', '@' and dots between words, at most 128 characters). version is refused: count by pod and add up the pods of each version.
1 - 8 elementsResponse
The matching lines counted by each field