[TP] Lab: Logs Collection and Forwarding to Loki


Set up an alloy loki pipeline to collect local logs, transform them via loki process, and send them to Loki.

What you will learn in this TP :

Introduction

The goal of this lab is to configure Grafana Alloy to read local log files, add context labels to them, and send everything to a Grafana Loki instance.

Logs Pipeline

We will configure the blocks that make up the pipeline using the River language.
  1. 1. Logs source
    Add the configuration to discover and read the `/var/log/myapp/*.log` files.
  2. 2. Logs processing
    Add a processing block to dynamically add an `env=production` label to all collected log lines.
  3. 3. Forwarding to Loki
    Configure sending the logs to a Loki instance available at `http://localhost:3100`.

Difficulty level: (2/5)

Recommended Articles

License consumption types

Understand the evolution of billing in Dynatrace: the difference between the ...

Grafana Alloy: The importance of Self-Monitoring

Discover why and how to configure Grafana Alloy so that it monitors itself, c...

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

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

Grafana Alloy: Introduction and Architecture

Discover the fundamental concepts of Grafana Alloy, the transition from the s...

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

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

Grafana Alloy: Metrics Collection (Prometheus & Ecosystem)

Learn how to configure Grafana Alloy to collect, transform, and forward metri...

Grafana Alloy: Log Management with Loki

Discover how to configure Grafana Alloy to read log files, journald, or netwo...

Grafana Alloy: Trace Management with Tempo

Dive into distributed trace processing. Learn how to ingest OTLP, Jaeger, or ...

Grafana Alloy: Continuous Profiling with Pyroscope

Discover how to configure continuous profiling in your environments using Gra...

Grafana Alloy: Advanced Deployment and Clustering

Learn how to manage large-scale Grafana Alloy deployments. Configure Clusteri...

Grafana Assistant: AI at the service of observability

Discover Grafana Assistant, the artificial intelligence integrated into Grafa...

Grafana Alloy vs Dynatrace ActiveGate: Which to choose?

Comparison between Grafana Alloy and Dynatrace ActiveGate. Understand the fun...

Course Glossary

Grafana Alloy

An open-source, vendor-neutral telemetry collector designed to replace Grafana Agent, fully compatible with OpenTelemetry (OTel).