RousselTMLEARNING

TP · Vector: from discovery to expertise

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...

Vector : les transforms en détail (remap et VRL, route, filter, réduction et métriques)

Transformer les événements dans Vector : remap et le langage VRL (analyse, enrichissement, gestio...

Bonnes pratiques de collecte de logs avec Fluent Bit et Vector

Check-list de production pour la collecte de logs : structure, filtrage à la source, masquage, ta...

Vector : les sources en détail

Les sources de Vector : fichiers, logs Kubernetes, journald, syslog, sockets, HTTP, OpenTelemetry...

Collecteurs de logs légers : Fluent Bit, Vector et les autres

Pourquoi un collecteur de logs, ce qui distingue les agents légers (Fluent Bit, Vector) des colle...

Vector : les sinks en détail (destinations, lots, tampons et réessais)

Envoyer les événements de Vector : sinks Loki, Elasticsearch, S3, Kafka, OpenTelemetry, Prometheu...

Fluent Bit ou Vector ? Choisir, combiner et migrer

Comparer Fluent Bit et Vector (performances, transformations, écosystème, gouvernance), les combi...

Logs avancés avec OpenPipeline : traitement, masquage, buckets et rétention

Gérer les logs dans Dynatrace avec OpenPipeline : ingestion, routage, traitement DQL (parsing, en...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!