-
-
Notifications
You must be signed in to change notification settings - Fork 69
HTTP API
Lorenzo Mangani edited this page Nov 21, 2021
·
25 revisions
cLoki API Functions are loosely implemented as documented by the Loki API reference.
- /loki/api/v1/push
- /loki/api/v1/query
- /loki/api/v1/query_range
- /loki/api/v1/label
- /loki/api/v1/label/name/values
- /loki/api/v1/tail
- /hello
- /ready
curl -i -XPOST -H "Content-Type: application/json" http://localhost:3100/loki/api/v1/push --data '{"streams":[{"labels":"{\"__name__\":\"up\"}","entries":[{"timestamp":"2018-12-26T16:00:06.944Z","line":"zzz"}]}]}'
curl -G -s localhost:3100/loki/api/v1/query_range --data-urlencode 'query={__name__="up"}'
{
"streams": [
{
"labels": "{\"__name__\":\"up\"}",
"entries": [
{
"timestamp":"1545840006944",
"line":"zzz"
},
{
"timestamp":"1545840006944",
"line":"zzz"
},
{
"timestamp": "1545840006944",
"line":"zzz"
}
]
}
]
}
# curl localhost:3100/loki/api/v1/label
{"status": "success", "data":["__name__"]}
# curl 'localhost:3100/loki/api/v1/label/__name__/values'
{"status": "success", "data":["up"]}
curl -i -XPOST -H "Content-Type: application/json" http://localhost:3100/loki/api/v1/push --data '{"streams":[{"labels":"{\"__name__\":\"metric\"}","entries":[{"timestamp":"2018-12-26T16:00:06.944Z","value":"100"}]}]}'