Skip to content
Create an account

Logs

Logs #

Send your applications' logs with OpenTelemetry (OTLP/HTTP), then search them and follow them live in Monitoring → Logs. You keep your OpenTelemetry SDK or Collector: only the endpoint and the authentication header change.

Plans and retention

Logs are included in these plans:

  • Business: 10 GB of logs a month, kept 30 days
  • Entreprise: 50 GB of logs a month, kept 180 days

Not included in the Discover, Start plans.

Quick start

Three steps, whatever your language or platform. The page of a key in the dashboard shows the same values with your key already filled in.

1. Create an ingest key

Create an ingest key in Monitoring → Logs → Ingest keys, or a key with the Logs scope in API keys.

Copy the access key (pk_…) and the secret (sk_…). The secret is shown only once: if you lose it, create a new key.

A Logs key only sends logs: the messaging API refuses it. The other way round, a regular API key is refused by the logs endpoint.

2. Set the environment variables

Every OpenTelemetry SDK reads these standard variables. Replace checkout-api with the name of your application, and the base64 value with your key.

Shell
OTEL_SERVICE_NAME=checkout-api
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://logs.callistosignal.com/v1/logs
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_LOGS_HEADERS=Authorization=Basic%20<base64(pk_…:sk_…)>

The base64 value is pk_…:sk_… encoded, for example with echo -n "pk_…:sk_…"

3. Send a test log

This request needs no SDK. The answer 200 with an empty object means the log was accepted.

cURL
curl -X POST "https://logs.callistosignal.com/v1/logs" \
-u "pk_…:sk_…" \
-H "Content-Type: application/json" \
-d '{
"resourceLogs": [{
"resource": { "attributes": [
{ "key": "service.name", "value": { "stringValue": "checkout-api" } }
] },
"scopeLogs": [{
"logRecords": [{
"timeUnixNano": "'"$(date +%s)"'000000000",
"severityNumber": 17,
"severityText": "ERROR",
"body": { "stringValue": "payment provider timeout" },
"traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
"spanId": "00f067aa0ba902b7",
"attributes": [
{ "key": "order_id", "value": { "stringValue": "ord_8F2KQ" } }
]
}]
}]
}]
}'

Open Monitoring → Logs: the log appears under the service checkout-api. If it does not, go to Troubleshooting.

Language guides

Each snippet uses the official OpenTelemetry SDK with its OTLP/HTTP log exporter and the variables of step 2. Initialize it once, when your application starts, then log as usual.

Install
npm install @opentelemetry/api-logs @opentelemetry/sdk-logs \
@opentelemetry/exporter-logs-otlp-proto @opentelemetry/resources
Initialization
const { logs, SeverityNumber } = require('@opentelemetry/api-logs');
const { LoggerProvider, BatchLogRecordProcessor } = require('@opentelemetry/sdk-logs');
const { OTLPLogExporter } = require('@opentelemetry/exporter-logs-otlp-proto');
const { resourceFromAttributes } = require('@opentelemetry/resources');

const provider = new LoggerProvider({
resource: resourceFromAttributes({
'service.name': process.env.OTEL_SERVICE_NAME || 'checkout-api',
}),
processors: [
new BatchLogRecordProcessor(
new OTLPLogExporter({
url: 'https://logs.callistosignal.com/v1/logs',
headers: { Authorization: `Basic ${process.env.CALLISTO_LOGS_BASIC}` },
}),
),
],
});
logs.setGlobalLoggerProvider(provider);

const logger = logs.getLogger('checkout-api');
logger.emit({
severityNumber: SeverityNumber.INFO,
severityText: 'INFO',
body: 'order created',
attributes: { order_id: 'ord_8F2KQ' },
});
Install
pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
Initialization
import logging

from opentelemetry._logs import set_logger_provider
from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor

provider = LoggerProvider()
provider.add_log_record_processor(BatchLogRecordProcessor(OTLPLogExporter()))
set_logger_provider(provider)

logging.getLogger().setLevel(logging.INFO)
logging.getLogger().addHandler(LoggingHandler(level=logging.INFO, logger_provider=provider))

logging.getLogger("checkout").info("order created", extra={"order_id": "ord_8F2KQ"})
Install
curl -L -O https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
Run
java -javaagent:./opentelemetry-javaagent.jar \
-Dotel.logs.exporter=otlp \
-Dotel.traces.exporter=none \
-Dotel.metrics.exporter=none \
-jar app.jar
Install
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol
Variables
CALLISTO_LOGS_BASIC=<base64(pk_…:sk_…)>
Initialization
using OpenTelemetry.Exporter;
using OpenTelemetry.Logs;
using OpenTelemetry.Resources;

var builder = WebApplication.CreateBuilder(args);

builder.Logging.AddOpenTelemetry(options =>
{
options.IncludeFormattedMessage = true;
options.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("checkout-api"));
options.AddOtlpExporter(otlp =>
{
otlp.Endpoint = new Uri("https://logs.callistosignal.com/v1/logs");
otlp.Protocol = OtlpExportProtocol.HttpProtobuf;
otlp.Headers = $"Authorization=Basic {Environment.GetEnvironmentVariable("CALLISTO_LOGS_BASIC")}";
});
});
Install
go get go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp \
go.opentelemetry.io/otel/sdk/log \
go.opentelemetry.io/otel/log \
go.opentelemetry.io/contrib/bridges/otelslog
Initialization
package main

import (
"context"
"log/slog"

"go.opentelemetry.io/contrib/bridges/otelslog"
"go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp"
"go.opentelemetry.io/otel/log/global"
sdklog "go.opentelemetry.io/otel/sdk/log"
)

func main() {
ctx := context.Background()

exporter, err := otlploghttp.New(ctx)
if err != nil {
panic(err)
}

provider := sdklog.NewLoggerProvider(
sdklog.WithProcessor(sdklog.NewBatchProcessor(exporter)),
)
defer provider.Shutdown(ctx)
global.SetLoggerProvider(provider)

logger := slog.New(otelslog.NewHandler("checkout-api"))
logger.Info("order created", "order_id", "ord_8F2KQ")
}
Install
composer require monolog/monolog open-telemetry/sdk open-telemetry/exporter-otlp \
open-telemetry/opentelemetry-logger-monolog php-http/guzzle7-adapter
Variables
OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_LOGS_EXPORTER=otlp
Initialization
use Monolog\Level;
use Monolog\Logger;
use OpenTelemetry\API\Globals;
use OpenTelemetry\Contrib\Logs\Monolog\Handler;

$logger = new Logger('checkout-api', [
new Handler(Globals::loggerProvider(), Level::Info),
]);

$logger->info('order created', ['order_id' => 'ord_8F2KQ']);
Install
composer require open-telemetry/sdk open-telemetry/exporter-otlp \
open-telemetry/opentelemetry-logger-monolog php-http/guzzle7-adapter
Variables
OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_LOGS_EXPORTER=otlp
LOG_CHANNEL=callisto
app/Logging/CallistoLogger.php
namespace App\Logging;

use Monolog\Level;
use Monolog\Logger;
use OpenTelemetry\API\Globals;
use OpenTelemetry\Contrib\Logs\Monolog\Handler;

class CallistoLogger
{
public function __invoke(array $config): Logger
{
return new Logger('callisto', [
new Handler(Globals::loggerProvider(), Level::Info),
]);
}
}
config/logging.php, in channels
'callisto' => [
'driver' => 'custom',
'via' => App\Logging\CallistoLogger::class,
],

Written for @opentelemetry/sdk-logs 0.200 or later. The endpoint and the header are set in code: CALLISTO_LOGS_BASIC holds the plain base64 of pk_…:sk_…, and the variables of step 2 are not needed. Call provider.shutdown() before a short script exits, so the last batch is sent.

Any call to the standard logging module goes through the handler. The root logger sends warnings and above unless you lower its level, as the snippet does. Call provider.shutdown() before a short script exits.

The agent hooks Logback, Log4j 2 and java.util.logging: your code does not change. Export the variables of step 2 in the environment of the process.

Every ILogger call goes through the provider. Here the endpoint and the header are set in code, so the variables of step 2 are not needed: CALLISTO_LOGS_BASIC holds the plain base64, without the percent-encoding.

The otelslog bridge sends the log/slog records. The service name comes from OTEL_SERVICE_NAME. Call provider.Shutdown before the program exits.

The SDK needs a PSR-18 HTTP client (the Guzzle adapter above) and its autoloader enabled by OTEL_PHP_AUTOLOAD_ENABLED. The variables of step 2 go with the two above. The handler sends every Monolog record.

Install the packages and set the variables as for PHP, create the class, add the channel, then set LOG_CHANNEL=callisto, or add callisto to the channels of your stack.

Ruby: the OpenTelemetry logs signal is experimental for Ruby. Write your logs to a file or to the output, and send them with an OpenTelemetry Collector (see Platforms).

Platforms

To collect log files or the output of containers without touching the application, run an OpenTelemetry Collector or Fluent Bit next to it.

Configuration
receivers:
otlp:
protocols:
http:
filelog:
include: [/var/log/myapp/*.log]
start_at: end

processors:
resource/callisto:
attributes:
- key: service.name
value: checkout-api
action: insert
batch:

exporters:
otlphttp/callisto:
logs_endpoint: https://logs.callistosignal.com/v1/logs
headers:
Authorization: "Basic ${env:CALLISTO_LOGS_BASIC}"

service:
pipelines:
logs:
receivers: [otlp, filelog]
processors: [resource/callisto, batch]
exporters: [otlphttp/callisto]
Run
export CALLISTO_LOGS_BASIC="<base64(pk_…:sk_…)>"
otelcol-contrib --config otel-collector.yaml
docker-compose.yml
services:
app:
image: my-app:latest
environment:
OTEL_SERVICE_NAME: checkout-api
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: https://logs.callistosignal.com/v1/logs
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL: http/protobuf
OTEL_EXPORTER_OTLP_LOGS_HEADERS: "Authorization=Basic%20<base64(pk_…:sk_…)>"
Or with a Collector sidecar, instead of the variables above
services:
app:
image: my-app:latest
environment:
OTEL_SERVICE_NAME: checkout-api
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: http://collector:4318/v1/logs
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL: http/protobuf

collector:
image: otel/opentelemetry-collector-contrib:latest
command: ["--config=/etc/otelcol/config.yaml"]
environment:
CALLISTO_LOGS_BASIC: "<base64(pk_…:sk_…)>"
volumes:
- ./otel-collector.yaml:/etc/otelcol/config.yaml:ro
Collector as a DaemonSet
apiVersion: v1
kind: Secret
metadata:
name: callisto-logs
stringData:
basic: "<base64(pk_…:sk_…)>"
headers: "Authorization=Basic%20<base64(pk_…:sk_…)>"
---
apiVersion: v1
kind: ConfigMap
metadata:
name: callisto-otel-collector
data:
config.yaml: |
receivers:
filelog:
include: [/var/log/pods/*/*/*.log]
include_file_path: true
start_at: end
operators:
- type: container
processors:
resource/callisto:
attributes:
- key: service.name
from_attribute: k8s.container.name
action: insert
batch:
exporters:
otlphttp/callisto:
logs_endpoint: https://logs.callistosignal.com/v1/logs
headers:
Authorization: "Basic ${env:CALLISTO_LOGS_BASIC}"
service:
pipelines:
logs:
receivers: [filelog]
processors: [resource/callisto, batch]
exporters: [otlphttp/callisto]
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: callisto-otel-collector
spec:
selector:
matchLabels:
app: callisto-otel-collector
template:
metadata:
labels:
app: callisto-otel-collector
spec:
containers:
- name: collector
image: otel/opentelemetry-collector-contrib:latest
args: ["--config=/etc/otelcol/config.yaml"]
env:
- name: CALLISTO_LOGS_BASIC
    valueFrom:
    secretKeyRef:
        name: callisto-logs
        key: basic
volumeMounts:
- name: config
    mountPath: /etc/otelcol
- name: pods
    mountPath: /var/log/pods
    readOnly: true
volumes:
- name: config
configMap:
name: callisto-otel-collector
- name: pods
hostPath:
path: /var/log/pods
Or, on a Deployment, in the container
env:
- name: OTEL_SERVICE_NAME
value: checkout-api
- name: OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
value: https://logs.callistosignal.com/v1/logs
- name: OTEL_EXPORTER_OTLP_LOGS_PROTOCOL
value: http/protobuf
- name: OTEL_EXPORTER_OTLP_LOGS_HEADERS
valueFrom:
secretKeyRef:
name: callisto-logs
key: headers
fluent-bit.conf
[INPUT]
Name   tail
Path   /var/log/myapp/*.log

[OUTPUT]
Name                   opentelemetry
Match                  *
Host                   logs.callistosignal.com
Port                   443
Logs_uri               /v1/logs
Tls                    On
Header                 Authorization Basic <base64(pk_…:sk_…)>
Log_response_payload   True

The otlp receiver takes the logs your SDKs send, the filelog receiver reads files. CALLISTO_LOGS_BASIC holds the plain base64 of pk_…:sk_…. The resource processor gives a service.name to logs that have none: a name the application already set is kept.

Either give the container the variables of step 2, or point the application at a Collector in the same network and keep the key in one place. The Collector configuration is the one of the previous tab, saved as otel-collector.yaml.

The Collector reads the logs of every pod on its node and names each service after its container. The key is in a Secret. The Collector image must be the contrib distribution, which holds the filelog receiver. To send logs from the application itself, put the variables of step 2 in the container, with the header in a Secret.

The opentelemetry output sends the records as OTLP over HTTPS. Check that a service.name arrives: without one, the logs are grouped under "No service". To name them, go through a Collector.

Reference

The request

Parameter Description
https://logs.callistosignal.com/v1/logs POST to this full URL. Give it to OTEL_EXPORTER_OTLP_LOGS_ENDPOINT, the variable for logs only, which an SDK uses as it is.
Authorization HTTP Basic: Authorization: Basic base64(pk_…:sk_…). Only a Logs key is accepted.
Content-Type application/x-protobuf, which http/protobuf sends, or application/json (OTLP's JSON encoding, with traceId and spanId in hexadecimal). Any other type is refused with 415.
Content-Encoding None, or gzip. Any other encoding is refused with 415.
service.name Resource attribute that names the source. Without it, the logs are stored under unknown_service and shown as "No service".

Stored fields

Parameter Description
timeUnixNano When the log happened. Otherwise observedTimeUnixNano, then the time it was received.
severityNumber, severityText The level, from TRACE to FATAL. When severityText is empty, it comes from severityNumber.
service.name Resource attribute naming the service: each name makes a source. unknown_service when it is missing.
body The message. A structured value is stored as text.
traceId, spanId The trace and span ids, in hexadecimal in JSON.
attributes The resource and log attributes. The scope's name and version and the event name are kept as attributes.

Limits

  • Body: 5 MB at most, compressed and once decompressed.
  • At most 50,000 logs per request.
  • At most 10,000 resource and scope blocks per request.
  • A log dated before your plan's retention, or more than one hour in the future, is refused and counted in partialSuccess. The other logs of the request are accepted.

Response

{
"partialSuccess": {
"rejectedLogRecords": "2",
"errorMessage": "2 log records rejected: timestamp older than the retention or more than 1 h ahead"
}
}

When every log is accepted, the response is an empty object. It follows the request format: JSON or protobuf.

Responses

Code Meaning What to do
200 Accepted. When some logs are rejected, the body holds partialSuccess. Nothing to send again. If rejectedLogRecords is not 0, check the dates of those logs.
400 The body cannot be read: invalid protobuf or JSON, invalid gzip, or a trace id that is not hexadecimal. Do not retry. Fix the payload, and check that the Content-Type matches the body.
401 The key is missing, invalid or disabled, the secret is wrong, the key is not a Logs key, or the key does not allow your IP address. The answer is the same in every case, on purpose. Do not retry. Check the header, then the status and the allowed IP addresses of the key in the dashboard. If the secret is lost, create a new key.
403 The plan of your organization does not include logs. Do not retry. Choose a plan that includes logs (see Plans above).
413 The body is larger than 5 MB, compressed or not, or it holds more than 50,000 logs or 10,000 resource and scope blocks. Do not retry as it is. Send smaller batches: in an SDK, lower OTEL_BLRP_MAX_EXPORT_BATCH_SIZE.
415 The Content-Type or the Content-Encoding is not supported. Use http/protobuf or http/json. OTLP over gRPC is not offered.
429 The monthly log volume of the plan is exceeded. Wait for the delay in the Retry-After header, then send again. OpenTelemetry exporters do it on their own.
503 Temporary: the service is busy or cannot reach one of its dependencies. Send again after the Retry-After delay. Exporters do it on their own, and do the same for 502 and 504.

Retention and volume

A log is kept for the retention of your plan, in days in the list under Plans at the top of this section, then deleted. A log dated before that retention is refused when it is sent. The volume is the monthly volume of the plan.

Search JSON log messages

Log messages whose body is JSON are formatted for reading. In the search field, use $.name to select a JSON value: $.level = "error" finds matching values, and $.duration > 500 compares numbers. Supported comparisons are =, !=, >, < and like. Compare two fields with $.x = $.y. Combine conditions with and, or, not and parentheses, for example $.level = "error" and $.duration > 500. If the message is not JSON, it remains searchable as raw text.

One key, several applications

One ingest key is enough for all your applications; each application is identified by service.name.

With an OpenTelemetry SDK, set that name with the OTEL_SERVICE_NAME variable. With a Collector, a resource processor gives it to logs that arrive without a name. The snippets further down show both.

You can create more keys, up to 50 per organization, to isolate an application: you can then disable, replace or delete its key, or purge its logs, without touching the others. With a single key, a leak means replacing it in all your applications at once.

Sources

  • The Monitoring → Logs → Sources page lists the services found in your logs' service.name. Nothing to create: a source shows up with its first logs. Logs without a service name, or with unknown_service (OpenTelemetry's default), are grouped under "No service".
  • From that page, an owner or admin of the organization can purge a service's logs, whichever key sent them, by typing the service name to confirm. The logs are erased within 7 days at most, and new logs from the service keep coming in.
  • Deleting a key stops it immediately, but does not erase the logs already received: they stay until the end of your plan's retention. To erase them sooner, purge the key, even a deleted one (Monitoring → Logs → Ingest keys), or the service concerned.

Personal data: do not send personal data in your logs (e-mails, phone numbers, passwords, tokens).

Troubleshooting

Nothing shows up in Monitoring → Logs? Start with the test request of step 3. If it works, the problem is in the configuration of your SDK or Collector, not in the key.

Symptom What to check
The answer is 401 The header is Basic followed by the base64 of pk_…:sk_…, with the colon and no space; in an environment variable, the space is written %20. The key is a Logs key, enabled and not deleted. If it restricts IP addresses, the public address of your server is in the list. The service never says which of these failed.
The answer is 403 The plan of your organization does not include logs. See Plans at the top of this section.
The answer is 400 or 415 The protocol is http/protobuf or http/json, not grpc. The Content-Type matches the body, and the Content-Encoding is gzip or absent.
The exporter reports a connection error or a path that is not found The endpoint is the full URL https://logs.callistosignal.com/v1/logs, in the variable for logs only. Do not put it in OTEL_EXPORTER_OTLP_ENDPOINT: SDKs add a path to that one.
The answer is 200 but a log is missing Look at rejectedLogRecords in the answer: a log dated before the retention of your plan, or more than one hour ahead, is refused. Check the clock of the server. Also check the level of your logger: Python's root logger ignores logs below warning by default.
The logs are under "No service" The service.name resource attribute is missing. Set OTEL_SERVICE_NAME in the application, or add the resource processor to your Collector.
Nothing leaves the application and there is no error Exporters send in batches and keep their errors quiet. A short script or job must call shutdown on the provider before it exits. To see what happens, run the test request of step 3 with the same key.
The answers are 429 or 503 Both are temporary and are sent again after the Retry-After delay. A 429 that lasts means the monthly volume of the plan is used up.

Searching happens in the dashboard. There is no public API to search logs.