Ingest Logs
curl --request POST \
--url https://api.example.com/api/v1/ingest/logs \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"logs": [
{
"project_slug": "<string>",
"app_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"environment": "<string>",
"level": "<string>",
"message": "<string>",
"logger_name": "",
"endpoint_method": "",
"endpoint_path": "",
"status_code": 0,
"consumer_id": "",
"consumer_name": "",
"consumer_group": "",
"trace_id": "",
"span_id": "",
"payload": "",
"attributes": {}
}
]
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
logs: [
{
project_slug: '<string>',
app_id: '<string>',
timestamp: '2023-11-07T05:31:56Z',
environment: '<string>',
level: '<string>',
message: '<string>',
logger_name: '',
endpoint_method: '',
endpoint_path: '',
status_code: 0,
consumer_id: '',
consumer_name: '',
consumer_group: '',
trace_id: '',
span_id: '',
payload: '',
attributes: {}
}
]
})
};
fetch('https://api.example.com/api/v1/ingest/logs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.example.com/api/v1/ingest/logs"
payload = { "logs": [
{
"project_slug": "<string>",
"app_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"environment": "<string>",
"level": "<string>",
"message": "<string>",
"logger_name": "",
"endpoint_method": "",
"endpoint_path": "",
"status_code": 0,
"consumer_id": "",
"consumer_name": "",
"consumer_group": "",
"trace_id": "",
"span_id": "",
"payload": "",
"attributes": {}
}
] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"accepted": 123
}Ingest
Ingest Logs
Ingest application log records. API key provides project_id, payload provides app_id (UUID or slug) for each log.
POST
/
api
/
v1
/
ingest
/
logs
Ingest Logs
curl --request POST \
--url https://api.example.com/api/v1/ingest/logs \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"logs": [
{
"project_slug": "<string>",
"app_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"environment": "<string>",
"level": "<string>",
"message": "<string>",
"logger_name": "",
"endpoint_method": "",
"endpoint_path": "",
"status_code": 0,
"consumer_id": "",
"consumer_name": "",
"consumer_group": "",
"trace_id": "",
"span_id": "",
"payload": "",
"attributes": {}
}
]
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
logs: [
{
project_slug: '<string>',
app_id: '<string>',
timestamp: '2023-11-07T05:31:56Z',
environment: '<string>',
level: '<string>',
message: '<string>',
logger_name: '',
endpoint_method: '',
endpoint_path: '',
status_code: 0,
consumer_id: '',
consumer_name: '',
consumer_group: '',
trace_id: '',
span_id: '',
payload: '',
attributes: {}
}
]
})
};
fetch('https://api.example.com/api/v1/ingest/logs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.example.com/api/v1/ingest/logs"
payload = { "logs": [
{
"project_slug": "<string>",
"app_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"environment": "<string>",
"level": "<string>",
"message": "<string>",
"logger_name": "",
"endpoint_method": "",
"endpoint_path": "",
"status_code": 0,
"consumer_id": "",
"consumer_name": "",
"consumer_group": "",
"trace_id": "",
"span_id": "",
"payload": "",
"attributes": {}
}
] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"accepted": 123
}⌘I