RousselTMLEARNING

TP · Fluent Bit and Vector: lightweight log collection

Lab: Parse nginx logs with Vector and VRL

What you will learn in this TP
  • Write a VRL transformation
  • Route to Loki
  • Produce metrics

Introduction #

What you will learn in this section
  • Write a VRL transformation
  • Route to Loki
  • Produce metrics

Context. The website exposes no HTTP metrics, but nginx writes access logs. You get both structured logs and metrics out of them.

Prerequisites: Docker Compose  ·  Estimated time: 45 min

Structured logs and metrics from a simple file.

Setup #

Guided steps, with their solutions.

  1. 1. Prepare nginx and the traffic

    Why? nginx writes its logs to a volume shared with Vector.

    Create a Compose file with nginx (logs in a volume), a request generator (including 404s) and Loki.
  2. 2. Write the transformation

    Why? VRL extracts the fields and converts the types: you can then filter and aggregate.

    Create vector.yaml with a file source and a remap that parses the combined format.
  3. 3. Run and observe

    Why? vector tap shows the transformed events live.

    Add Vector to the Compose file, start it and inspect the output of parse.
  4. 4. Derive metrics

    Why? To count requests by status without touching nginx.

    Add a log_to_metric and a prometheus_exporter sink on port 9598, then read the metrics.
  5. 5. Check in Loki

    Why? The extracted fields can be filtered directly in LogQL.

    Display the 404 requests.

Difficulty level : ●●●○○ (3/5)

My progress

  • ⏱ Estimated time : ≈ 45 min

Sign in to track your progress and take notes. Sign in

✉️ Ask a question

Recommended Articles

Vector : sources, transforms, sinks et topologie

Les concepts de Vector (sources, transforms, sinks), la configuration YAML, les composants couran...

Transformer avec VRL et tester ses pipelines Vector

Le langage VRL (Vector Remap Language) : analyse de logs (JSON, regex, syslog), gestion des erreu...

Understanding the concept of score

The concept of score allows Elasticsearch to rank your documents by relevance during a search.

Understanding the Elastic Common Schema (ECS)

As always in our consulting engagements, we recommend that companies harmonise and standardise: k...

License consumption types

Understand the evolution of billing in Dynatrace: the difference between the old licensing model ...

Grafana Alloy: The importance of Self-Monitoring

Discover why and how to configure Grafana Alloy so that it monitors itself, collecting its own lo...

Grafana Alloy: Understanding and exploiting the User Interface (UI)

Discover how to enable, secure, and use Grafana Alloy's built-in web interface to visualize your ...

Grafana Alloy: Introduction and Architecture

Discover the fundamental concepts of Grafana Alloy, the transition from the static Agent to Alloy...

Grafana Alloy: Syntax and Configuration (Alloy Language: River)

As part of a Grafana training or observability training, master the declarative syntax of Grafana...