Send Log Lines
Use this method to send logs to a logging instance.
Authentication
You can find instructions on authentication here. Ingestion is
similar to the other APIs, but instead of servicekey you will use apikey if
you are using the header style authentication.
Metadata
Meta is a field reserved for custom information associated with a log line. To add
metadata to an API call, specify the meta field under the lines object. Metadata can be
viewed inside that line’s context
WARNING: If inconsistent value types are
used, that line’s metadata, will not be parsed. For example, if a line is passed
with a meta object, such as meta.myfield of type String, any subsequent lines
with meta.myfield must have a String as the value type for meta.myfield.
Please be aware of service limits on this endpoint
curl --request POST \
--url https://logs.mezmo.com/logs/ingest \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"lines": [
{
"line": "<string>",
"timestamp": "<string>",
"app": "<string>",
"level": "<string>",
"meta": "<string>"
}
]
}
'import requests
url = "https://logs.mezmo.com/logs/ingest"
payload = { "lines": [
{
"line": "<string>",
"timestamp": "<string>",
"app": "<string>",
"level": "<string>",
"meta": "<string>"
}
] }
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
lines: [
{
line: '<string>',
timestamp: '<string>',
app: '<string>',
level: '<string>',
meta: '<string>'
}
]
})
};
fetch('https://logs.mezmo.com/logs/ingest', 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://logs.mezmo.com/logs/ingest",
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([
'lines' => [
[
'line' => '<string>',
'timestamp' => '<string>',
'app' => '<string>',
'level' => '<string>',
'meta' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://logs.mezmo.com/logs/ingest"
payload := strings.NewReader("{\n \"lines\": [\n {\n \"line\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"app\": \"<string>\",\n \"level\": \"<string>\",\n \"meta\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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://logs.mezmo.com/logs/ingest")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"line\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"app\": \"<string>\",\n \"level\": \"<string>\",\n \"meta\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://logs.mezmo.com/logs/ingest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"lines\": [\n {\n \"line\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"app\": \"<string>\",\n \"level\": \"<string>\",\n \"meta\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{}This response has no body data.This response has no body data.This response has no body data.Authorizations
(Deprecated) This key is used for ingestion. You can obtain it following these instructions and placing the key in the header of your call. NOTE Usage of the apikey auth mechanism has been deprecated in favor of IAM Access Tokens. Service keys can no longer be created, but can still be used for v1 and v2 apis while the transition takes place
Query Parameters
Was this page helpful?
curl --request POST \
--url https://logs.mezmo.com/logs/ingest \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"lines": [
{
"line": "<string>",
"timestamp": "<string>",
"app": "<string>",
"level": "<string>",
"meta": "<string>"
}
]
}
'import requests
url = "https://logs.mezmo.com/logs/ingest"
payload = { "lines": [
{
"line": "<string>",
"timestamp": "<string>",
"app": "<string>",
"level": "<string>",
"meta": "<string>"
}
] }
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
lines: [
{
line: '<string>',
timestamp: '<string>',
app: '<string>',
level: '<string>',
meta: '<string>'
}
]
})
};
fetch('https://logs.mezmo.com/logs/ingest', 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://logs.mezmo.com/logs/ingest",
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([
'lines' => [
[
'line' => '<string>',
'timestamp' => '<string>',
'app' => '<string>',
'level' => '<string>',
'meta' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://logs.mezmo.com/logs/ingest"
payload := strings.NewReader("{\n \"lines\": [\n {\n \"line\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"app\": \"<string>\",\n \"level\": \"<string>\",\n \"meta\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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://logs.mezmo.com/logs/ingest")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"line\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"app\": \"<string>\",\n \"level\": \"<string>\",\n \"meta\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://logs.mezmo.com/logs/ingest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"lines\": [\n {\n \"line\": \"<string>\",\n \"timestamp\": \"<string>\",\n \"app\": \"<string>\",\n \"level\": \"<string>\",\n \"meta\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{}This response has no body data.This response has no body data.This response has no body data.
