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. 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. Write the transformation
Why? VRL extracts the fields and converts the types: you can then filter and aggregate.
Createvector.yamlwith afilesource and aremapthat parses the combined format.3. Run and observe
Why?
Add Vector to the Compose file, start it and inspect the output ofvector tapshows the transformed events live.parse.4. Derive metrics
Why? To count requests by status without touching nginx.
Add alog_to_metricand aprometheus_exportersink on port 9598, then read the metrics.5. Check in Loki
Why? The extracted fields can be filtered directly in LogQL.
Display the 404 requests.
Difficulty level : ●●●○○ (3/5)
My progress
Sign in to track your progress and take notes. Sign in
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...