Search log lines
curl --request POST \
--url https://appsignal.com/api/v2/logs/lines \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"site_id": "abc123",
"from": "2024-01-01T00:00:00Z",
"to": "2024-01-01T01:00:00Z",
"source_ids": [
"source-1",
"source-2"
],
"query": "error",
"pagination": {
"per_page": 50,
"order": "DESC",
"cursor": {
"time": null,
"id": null
}
}
}
'import requests
url = "https://appsignal.com/api/v2/logs/lines"
payload = {
"site_id": "abc123",
"from": "2024-01-01T00:00:00Z",
"to": "2024-01-01T01:00:00Z",
"source_ids": ["source-1", "source-2"],
"query": "error",
"pagination": {
"per_page": 50,
"order": "DESC",
"cursor": {
"time": None,
"id": None
}
}
}
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({
site_id: 'abc123',
from: '2024-01-01T00:00:00Z',
to: '2024-01-01T01:00:00Z',
source_ids: ['source-1', 'source-2'],
query: 'error',
pagination: {per_page: 50, order: 'DESC', cursor: {time: null, id: null}}
})
};
fetch('https://appsignal.com/api/v2/logs/lines', 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://appsignal.com/api/v2/logs/lines",
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([
'site_id' => 'abc123',
'from' => '2024-01-01T00:00:00Z',
'to' => '2024-01-01T01:00:00Z',
'source_ids' => [
'source-1',
'source-2'
],
'query' => 'error',
'pagination' => [
'per_page' => 50,
'order' => 'DESC',
'cursor' => [
'time' => null,
'id' => null
]
]
]),
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://appsignal.com/api/v2/logs/lines"
payload := strings.NewReader("{\n \"site_id\": \"abc123\",\n \"from\": \"2024-01-01T00:00:00Z\",\n \"to\": \"2024-01-01T01:00:00Z\",\n \"source_ids\": [\n \"source-1\",\n \"source-2\"\n ],\n \"query\": \"error\",\n \"pagination\": {\n \"per_page\": 50,\n \"order\": \"DESC\",\n \"cursor\": {\n \"time\": null,\n \"id\": null\n }\n }\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://appsignal.com/api/v2/logs/lines")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"site_id\": \"abc123\",\n \"from\": \"2024-01-01T00:00:00Z\",\n \"to\": \"2024-01-01T01:00:00Z\",\n \"source_ids\": [\n \"source-1\",\n \"source-2\"\n ],\n \"query\": \"error\",\n \"pagination\": {\n \"per_page\": 50,\n \"order\": \"DESC\",\n \"cursor\": {\n \"time\": null,\n \"id\": null\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://appsignal.com/api/v2/logs/lines")
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 \"site_id\": \"abc123\",\n \"from\": \"2024-01-01T00:00:00Z\",\n \"to\": \"2024-01-01T01:00:00Z\",\n \"source_ids\": [\n \"source-1\",\n \"source-2\"\n ],\n \"query\": \"error\",\n \"pagination\": {\n \"per_page\": 50,\n \"order\": \"DESC\",\n \"cursor\": {\n \"time\": null,\n \"id\": null\n }\n }\n}"
response = http.request(request)
puts response.read_body[
{
"timestamp": "2023-11-07T05:31:56Z",
"id": "<string>",
"source_id": "<string>",
"group": "<string>",
"severity": "<string>",
"message": "<string>",
"hostname": "<string>",
"json": "<string>"
}
]{
"error": "<string>",
"message": "<string>",
"details": "<unknown>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>",
"suggestion": "<string>"
}{
"error": "<string>"
}Authorizations
Authorization: Bearer <token>
Body
Filters and pagination for searching log lines.
Site to search; an empty value returns no log lines.
Log sources to search; an empty list returns no log lines.
Log search query; an empty string matches every line.
Page size, order and cursor.
Show child attributes
Show child attributes
Start of the time range; defaults to the start of the account's log retention and is clamped to it and now.
End of the time range; defaults to now and is clamped to from..now.
Response
The matching log lines, or a server-sent event stream whose data fields are each a LogStreamEvent.
When the line was logged, with millisecond precision.
Unique ID of the line.
Log source the line was ingested through.
Group the line belongs to, such as the app or service name.
Severity level, such as info or error.
The log message.
Host that emitted the line.
The line's attributes as a JSON-encoded string.
Was this page helpful?
curl --request POST \
--url https://appsignal.com/api/v2/logs/lines \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"site_id": "abc123",
"from": "2024-01-01T00:00:00Z",
"to": "2024-01-01T01:00:00Z",
"source_ids": [
"source-1",
"source-2"
],
"query": "error",
"pagination": {
"per_page": 50,
"order": "DESC",
"cursor": {
"time": null,
"id": null
}
}
}
'import requests
url = "https://appsignal.com/api/v2/logs/lines"
payload = {
"site_id": "abc123",
"from": "2024-01-01T00:00:00Z",
"to": "2024-01-01T01:00:00Z",
"source_ids": ["source-1", "source-2"],
"query": "error",
"pagination": {
"per_page": 50,
"order": "DESC",
"cursor": {
"time": None,
"id": None
}
}
}
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({
site_id: 'abc123',
from: '2024-01-01T00:00:00Z',
to: '2024-01-01T01:00:00Z',
source_ids: ['source-1', 'source-2'],
query: 'error',
pagination: {per_page: 50, order: 'DESC', cursor: {time: null, id: null}}
})
};
fetch('https://appsignal.com/api/v2/logs/lines', 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://appsignal.com/api/v2/logs/lines",
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([
'site_id' => 'abc123',
'from' => '2024-01-01T00:00:00Z',
'to' => '2024-01-01T01:00:00Z',
'source_ids' => [
'source-1',
'source-2'
],
'query' => 'error',
'pagination' => [
'per_page' => 50,
'order' => 'DESC',
'cursor' => [
'time' => null,
'id' => null
]
]
]),
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://appsignal.com/api/v2/logs/lines"
payload := strings.NewReader("{\n \"site_id\": \"abc123\",\n \"from\": \"2024-01-01T00:00:00Z\",\n \"to\": \"2024-01-01T01:00:00Z\",\n \"source_ids\": [\n \"source-1\",\n \"source-2\"\n ],\n \"query\": \"error\",\n \"pagination\": {\n \"per_page\": 50,\n \"order\": \"DESC\",\n \"cursor\": {\n \"time\": null,\n \"id\": null\n }\n }\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://appsignal.com/api/v2/logs/lines")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"site_id\": \"abc123\",\n \"from\": \"2024-01-01T00:00:00Z\",\n \"to\": \"2024-01-01T01:00:00Z\",\n \"source_ids\": [\n \"source-1\",\n \"source-2\"\n ],\n \"query\": \"error\",\n \"pagination\": {\n \"per_page\": 50,\n \"order\": \"DESC\",\n \"cursor\": {\n \"time\": null,\n \"id\": null\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://appsignal.com/api/v2/logs/lines")
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 \"site_id\": \"abc123\",\n \"from\": \"2024-01-01T00:00:00Z\",\n \"to\": \"2024-01-01T01:00:00Z\",\n \"source_ids\": [\n \"source-1\",\n \"source-2\"\n ],\n \"query\": \"error\",\n \"pagination\": {\n \"per_page\": 50,\n \"order\": \"DESC\",\n \"cursor\": {\n \"time\": null,\n \"id\": null\n }\n }\n}"
response = http.request(request)
puts response.read_body[
{
"timestamp": "2023-11-07T05:31:56Z",
"id": "<string>",
"source_id": "<string>",
"group": "<string>",
"severity": "<string>",
"message": "<string>",
"hostname": "<string>",
"json": "<string>"
}
]{
"error": "<string>",
"message": "<string>",
"details": "<unknown>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>",
"suggestion": "<string>"
}{
"error": "<string>"
}