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