Learn how to collect different types of data using Grafana Alloy components. This repository contains resources and guides to help you get started with collecting logs, metrics, and traces using Alloy's observability tools.
This repository is associated with our Grafana Alloy YouTube playlist that covers the following topics:
- Watch now: Collecting Logs
- Learn how to collect logs from various sources:
- Local files: Collect logs from file-based sources.
- Systemd-journal: Capture logs from systemd services.
- Docker containers: Stream logs from Docker container logs.
- Kubernetes pods: Gather logs from running Kubernetes pods.
- All logs are sent to Grafana Loki via Grafana Alloy
- Learn how to collect logs from various sources:
- Watch now: Collecting Metrics
- Kubernetes Pod and Service Discovery: Collecting Metrics from Pods and Services
- PodMonitor and ServiceMonitor Discovery: Collecting Metrics from Monitored Resources
- Collecting Metrics from Grafana Alloy Itself
- Using the Unix Exporter to Collect Hardware and OS Metrics from Unix-based Systems
- Using the cAdvisor Exporter to Collect Container Metrics
- Watch now: Collecting Traces
- Intro to tracing pipelines with Grafana Alloy
- Understanding traces, spans & instrumentation
- Manual instrumentation for a Python app
- Auto-instrumentation in Kubernetes with OTel Operator
- Deploying Tempo, Grafana & Alloy for trace collection
- Configuring OTLP receiver & exporter
- Viewing traces in Grafana
- Enhancing traces with processors:
- span - processor.span
- attributes - processor.attributes
- k8s attributes - processor.k8sattributes
- filter - processor.filter
- transform - processor.transform
- batch - processor.batch
- Building service graphs from trace data - connector.servicegraph
The following sections cover various Alloy components and how they can be utilized for logs, metrics, and traces:
In this section, we explore various ways to collect logs from different sources into Loki, focusing on the following types of logs:
Local files contain logs from different applications and systems stored on the disk. These logs can include application logs, system logs, or any other custom logs written to files. We will show how to collect these types of logs.
local.file_match
: A component for identifying the local log files you want to monitor.loki.source.file
: The source component that reads the log files.loki.write
: Writes the logs from local files into Loki.
Systemd is a system and service manager used by Linux distributions. Systemd logs contain messages about services, system events, and kernel logs. We will focus on collecting logs from the systemd journal.
loki.relabel
: A component to modify or filter the log labels before storing them.loki.source.journal
: Collects logs from the systemd journal.loki.write
: Writes the collected systemd journal logs into Loki.
Docker containers generate logs related to containerized applications. These logs can include stdout, stderr, and application logs. We'll cover how to collect logs from Docker containers.
discovery.docker
: Discovers the running Docker containers.discovery.relabel
: Used to relabel the discovered container logs.loki.source.docker
: Collects logs from Docker containers.loki.write
: Writes the container logs into Loki.
Kubernetes pods generate logs from the containers running inside them. These logs include application logs, errors, and system-level logs. We will cover how to collect logs from Kubernetes pods.
discovery.kubernetes
: Discovers the Kubernetes pods running in the cluster.discovery.relabel
: Relabels the pod logs based on specific rules.local.file_match
: Matches local files to collect logs from containers running within the pods.loki.source.file
: Collects logs from local files inside the pods.loki.process
: Processes the pod logs before writing them to Loki.loki.write
: Writes the Kubernetes pod logs into Loki.
For all related codes and configurations, click here.
🚧 Coming Soon: This section will cover how to collect and analyze metrics using Alloy, one of its key components. Stay tuned for updates!
🚧 Coming Soon: This section will provide a detailed guide on collecting and visualizing traces using Alloy. Stay tuned for updates!
For more in-depth details and advanced configuration options, make sure to check out the Grafana Alloy official documentation:
https://grafana.com/docs/alloy