Docs · By hand
Send logs and traces
At the end each request your servers handle opens as a trace, with its queries, its log lines and the error it threw.
Before you start
Logs and traces are in beta. Write to john@vinktar.com with your workspace's name and we turn them on. Each project then gets an OTLP key, in its settings under Logs and traces.
The OTLP key is a secret. Keep it in the server's environment. Browsers keep the Vinktar browser SDK, and a request from one is refused here.
Set it up with your agent
Paste this into a coding agent with Vinktar connected. It picks the packages for your stack and checks that the first lines arrived.
Send this app's server logs and traces to Vinktar, for the Vinktar project your-project.
1. Connect the Vinktar MCP server at https://mcp.vinktar.com/mcp and sign in when it asks. If you cannot add an MCP server, run `npx @vinktarhq/cli login` and use `vinktar call <tool> key=value` for every tool below.
2. Call `get_install_guide` with section "logs" and follow it for this stack. Servers only, never a browser.
3. Use `get_project_keys` for the OTLP key; never ask me to paste one, and keep it out of the code and the repository.
4. Run the app, make a few requests, then call `get_setup_status` and work down it until its logs and traces check is clean.
End with what you installed, what is sent, and every environment variable with where it goes locally and in production.1. Set the environment
These four are the same in every language.
OTEL_EXPORTER_OTLP_ENDPOINT=https://in.vinktar.com
OTEL_EXPORTER_OTLP_HEADERS=X-Vinktar-Key=vnk_sk_YOUR_OTLP_KEY
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_METRICS_EXPORTER=noneSet the protocol even where it looks like the default. Several SDKs start on gRPC, which Vinktar does not take. Then name the service, so two of them stay apart:
OTEL_SERVICE_NAME=api
OTEL_RESOURCE_ATTRIBUTES=service.version=GIT_SHA,deployment.environment.name=production2. Add OpenTelemetry
Laravel
composer require keepsuit/laravel-opentelemetry
# .env
OTEL_EXPORTER_OTLP_TIMEOUT=500For log lines, add the handler from the Vinktar PHP SDK:
composer require vinktarhq/php:^0.2@beta
// config/logging.php, under 'channels'; then add 'vinktar' to LOG_STACK
'vinktar' => [
'driver' => 'monolog',
'handler' => Vinktar\Monolog\VinktarHandler::class,
'level' => env('LOG_LEVEL', 'info'),
],
// app/Providers/AppServiceProvider.php, in register()
$this->app->singleton(\Vinktar\Client::class, fn () => new \Vinktar\Client([
'writeKey' => config('services.vinktar.key'),
'otlpKey' => config('services.vinktar.otlp_key'),
]));Symfony
composer require traceway/opentelemetry-symfony open-telemetry/exporter-otlp php-http/guzzle7-adapter
# in the server's environment: .env is read too late for these
OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_EXPORTER_OTLP_TIMEOUT=500
# config/packages/open_telemetry.yaml, to keep the text of each query
open_telemetry:
traces:
doctrine:
record_statements: trueLog lines use the same VinktarHandler, as a Monolog service. The PHP SDK's readme has it, and the kernel code that puts the visitor on each trace.
Keep the timeout. PHP sends while it finishes a request, and OpenTelemetry's own default waits ten seconds and tries four times. A busy app should send to a Collector on the same machine.
Node
npm install @vinktarhq/node @opentelemetry/sdk-node @opentelemetry/sdk-trace @opentelemetry/sdk-logs \
@opentelemetry/auto-instrumentations-node \
@opentelemetry/exporter-trace-otlp-proto @opentelemetry/exporter-logs-otlp-proto// otel.mjs, loaded before the app: node --import ./otel.mjs app.mjs
import { NodeSDK } from '@opentelemetry/sdk-node';
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
import { BatchLogRecordProcessor } from '@opentelemetry/sdk-logs';
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace';
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-proto';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';
import { vinktarLogRecordProcessor, vinktarSpanProcessor } from '@vinktarhq/node/otel';
new NodeSDK({
instrumentations: [getNodeAutoInstrumentations()],
spanProcessors: [vinktarSpanProcessor(), new BatchSpanProcessor({ exporter: new OTLPTraceExporter() })],
logRecordProcessors: [vinktarLogRecordProcessor(), new BatchLogRecordProcessor({ exporter: new OTLPLogExporter() })],
}).start();You need @vinktarhq/node 0.4.0 or later. Lines written with pino are sent as they are. winston also needs @opentelemetry/winston-transport, and console.log is not collected.
Python, Go, Ruby, Java and .NET
Use the language's OpenTelemetry SDK with the variables above. Python and Go have been run against Vinktar. The others speak the same protocol and have not.
OpenTelemetry Collector
exporters:
otlp_http:
endpoint: https://in.vinktar.com
compression: gzip
headers:
X-Vinktar-Key: ${env:VINKTAR_OTLP_KEY}
service:
pipelines:
traces: { receivers: [otlp], processors: [batch], exporters: [otlp_http] }
logs: { receivers: [otlp], processors: [batch], exporters: [otlp_http] }Sentry SDKs
If your DSN already points at Vinktar, turn on Take traces and logs from Sentry SDKs in the project's settings, then set a traces sample rate in your app. Server SDKs only.
3. Name the visitor
A trace joins the visit it served when the request carries the browser SDK's X-Vinktar-Session-Id and X-Vinktar-Device-Id headers and your server opens a scope from them with scopeFromHeaders(). The processors in @vinktarhq/node/otel and Vinktar\OpenTelemetry write it on every span. A page load has no such headers, because a browser cannot add them to a link.
4. Check that it arrives
Open Requests and Logs, or ask your agent to call get_setup_status. It says what arrived in the last day and what was refused, which an OpenTelemetry SDK only writes to its own log.
Where they show up
- On an issue, its trace and the log lines around it.
- On Requests, each route with its count, p50, p95 and errors.
- On Logs, by text, level, service or any attribute, as lines or as patterns.
- For agents,
search_logs,list_requests,get_traceandrun_sqloverlogsandspans. - On a session recording, the requests that visit made to your servers.
What is stored
Values under names such as password, token and card_number are masked as they arrive, and so are attributes that name a visitor's IP address. Common token formats are masked inside text. Anything else in a log line is stored as your app wrote it.
A record may be up to 7 days old. A line keeps 32 KB of text and 128 attributes of 2 KB each. The Free plan keeps logs and traces for 7 days and the paid plans for 30. They have a monthly allowance of their own, so they never use up your events or errors, and nothing is charged for them. See Security for where data lives.