Query logs
curl --request POST \
--url https://api.alerty.ai/query/logs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_time": "2023-01-01T00:00:00Z",
"end_time": "2023-01-02T00:00:00Z",
"service_name": "<string>",
"severity_text": "<string>",
"limit": 100
}
'import requests
url = "https://api.alerty.ai/query/logs"
payload = {
"start_time": "2023-01-01T00:00:00Z",
"end_time": "2023-01-02T00:00:00Z",
"service_name": "<string>",
"severity_text": "<string>",
"limit": 100
}
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_time: '2023-01-01T00:00:00Z',
end_time: '2023-01-02T00:00:00Z',
service_name: '<string>',
severity_text: '<string>',
limit: 100
})
};
fetch('https://api.alerty.ai/query/logs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.alerty.ai/query/logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'start_time' => '2023-01-01T00:00:00Z',
'end_time' => '2023-01-02T00:00:00Z',
'service_name' => '<string>',
'severity_text' => '<string>',
'limit' => 100
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.alerty.ai/query/logs"
payload := strings.NewReader("{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"severity_text\": \"<string>\",\n \"limit\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.alerty.ai/query/logs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"severity_text\": \"<string>\",\n \"limit\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.alerty.ai/query/logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"severity_text\": \"<string>\",\n \"limit\": 100\n}"
response = http.request(request)
puts response.read_body[
{
"timestamp": "2023-11-07T05:31:56Z",
"trace_id": "<string>",
"span_id": "<string>",
"trace_flags": 123,
"severity_text": "<string>",
"severity_number": 123,
"service_name": "<string>",
"body": "<string>",
"resource_schema_url": "<string>",
"resource_attributes": {},
"scope_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"log_attributes": {}
}
]{
"description": "A descriptive error message",
"code": 1400,
"field": "name"
}{
"description": "A descriptive error message",
"code": 1400,
"field": "name"
}API Reference
Query logs
Retrieve logs based on the specified filters.
POST
/
query
/
logs
Query logs
curl --request POST \
--url https://api.alerty.ai/query/logs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_time": "2023-01-01T00:00:00Z",
"end_time": "2023-01-02T00:00:00Z",
"service_name": "<string>",
"severity_text": "<string>",
"limit": 100
}
'import requests
url = "https://api.alerty.ai/query/logs"
payload = {
"start_time": "2023-01-01T00:00:00Z",
"end_time": "2023-01-02T00:00:00Z",
"service_name": "<string>",
"severity_text": "<string>",
"limit": 100
}
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_time: '2023-01-01T00:00:00Z',
end_time: '2023-01-02T00:00:00Z',
service_name: '<string>',
severity_text: '<string>',
limit: 100
})
};
fetch('https://api.alerty.ai/query/logs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.alerty.ai/query/logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'start_time' => '2023-01-01T00:00:00Z',
'end_time' => '2023-01-02T00:00:00Z',
'service_name' => '<string>',
'severity_text' => '<string>',
'limit' => 100
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.alerty.ai/query/logs"
payload := strings.NewReader("{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"severity_text\": \"<string>\",\n \"limit\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.alerty.ai/query/logs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"severity_text\": \"<string>\",\n \"limit\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.alerty.ai/query/logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_time\": \"2023-01-01T00:00:00Z\",\n \"end_time\": \"2023-01-02T00:00:00Z\",\n \"service_name\": \"<string>\",\n \"severity_text\": \"<string>\",\n \"limit\": 100\n}"
response = http.request(request)
puts response.read_body[
{
"timestamp": "2023-11-07T05:31:56Z",
"trace_id": "<string>",
"span_id": "<string>",
"trace_flags": 123,
"severity_text": "<string>",
"severity_number": 123,
"service_name": "<string>",
"body": "<string>",
"resource_schema_url": "<string>",
"resource_attributes": {},
"scope_schema_url": "<string>",
"scope_name": "<string>",
"scope_version": "<string>",
"scope_attributes": {},
"log_attributes": {}
}
]{
"description": "A descriptive error message",
"code": 1400,
"field": "name"
}{
"description": "A descriptive error message",
"code": 1400,
"field": "name"
}Authorizations
bearerAuthcookieAuth
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Start time for the query.
Example:
"2023-01-01T00:00:00Z"
End time for the query.
Example:
"2023-01-02T00:00:00Z"
Filter logs by service name.
Filter logs by severity text.
Limit the number of results.
Response
Logs retrieved
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I

