zerolog-vector

command module
v0.0.0-...-62b18ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: BSD-2-Clause Imports: 7 Imported by: 0

README

Zerolog and Vector example

This example demonstrates how to collect Zerolog logs with Vector.

Because Zerolog does not support context, we have to propagate trace_id and span_id in the log message:

logger.Error().
	// trace_id and span_id are needed to properly link the log message with the span.
	Str("trace_id", child1.SpanContext().TraceID().String()).
	Str("span_id", child1.SpanContext().SpanID().String()).
	Str("foo", "bar").
	Msg("message from zerolog")

That is not very convenient, so we recommend to use Zap or logrus instead.

Running this example

Step 1. Replace headers.uptrace-dsn in vector.toml with your Uptrace DSN.

Step 2. Start Vector:

vector --config vector.toml

Step 3. Run the example:

UPTRACE_DSN="https://<token>@uptrace.dev/<project_id>" go run .

Click the link in your terminal to open Uptrace. See Structured Logging for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL