Group cluster log lines into patterns
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/patterns"
payload = { "step_seconds": 11 }
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({step_seconds: 11})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/patterns', 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/patterns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"step_seconds": 11
}
'{
"provider": "<string>",
"source": "<string>",
"note": "<string>",
"cluster_attribution": {},
"start": "<string>",
"end": "<string>",
"step_seconds": 123,
"bucket_count": 123,
"kept_days": 123,
"patterns": [
{
"level": "error",
"namespace": "<string>",
"container": "<string>",
"pattern": "<string>",
"count": 123,
"share": 123,
"first_seen": "<string>",
"last_seen": "<string>",
"sample": {
"timestamp": "<string>",
"line": "<string>",
"labels": {}
},
"history": "new",
"history_reason": "seen_in_lookback",
"history_note": "<string>",
"search_fragment": "<string>",
"bars": [
123
],
"lines_off_grid": 123
}
],
"distinct_patterns": 123,
"pattern_limit": 123,
"patterns_truncated": true,
"sampled_lines": 123,
"sample_limit": 123,
"total_hits": 123,
"total_hits_relation": "eq",
"counts_are_exact": true,
"history_start": "<string>",
"history_end": "<string>"
}Clusters
Group cluster log lines into patterns
The newest matching log lines of the window (at most 1000) grouped into patterns, in the store the history query reads, with the same source choice and filters. Each pattern carries its level, its share of the lines grouped, its lines per bar on the log volume count’s grid, the words a search can find it by, and whether it was also written in the 7 days before. Every count is within the lines grouped, and counts_are_exact says whether that was every matching line. A store that fails the window read answers an error, never an empty list.
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
/
patterns
Group cluster log lines into patterns
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/patterns"
payload = { "step_seconds": 11 }
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({step_seconds: 11})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/logs/patterns', 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/patterns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"step_seconds": 11
}
'{
"provider": "<string>",
"source": "<string>",
"note": "<string>",
"cluster_attribution": {},
"start": "<string>",
"end": "<string>",
"step_seconds": 123,
"bucket_count": 123,
"kept_days": 123,
"patterns": [
{
"level": "error",
"namespace": "<string>",
"container": "<string>",
"pattern": "<string>",
"count": 123,
"share": 123,
"first_seen": "<string>",
"last_seen": "<string>",
"sample": {
"timestamp": "<string>",
"line": "<string>",
"labels": {}
},
"history": "new",
"history_reason": "seen_in_lookback",
"history_note": "<string>",
"search_fragment": "<string>",
"bars": [
123
],
"lines_off_grid": 123
}
],
"distinct_patterns": 123,
"pattern_limit": 123,
"patterns_truncated": true,
"sampled_lines": 123,
"sample_limit": 123,
"total_hits": 123,
"total_hits_relation": "eq",
"counts_are_exact": true,
"history_start": "<string>",
"history_end": "<string>"
}Authorizations
Body
application/json
Response
Patterns among the newest matching lines