Skip to content

Commit 677e9fb

Browse files
committed
Merge branch 'main' of github.com:codeopsbymo/grafana-alloy into main
2 parents 8b01842 + 720f415 commit 677e9fb

File tree

2 files changed

+59
-3
lines changed

2 files changed

+59
-3
lines changed

README.md

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
1-
# grafana-alloy
2-
This repository contains all the code and configurations related to enabling Grafana Alloy to collect different types of data
1+
# Grafana Alloy
2+
3+
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.
4+
5+
## Sections
6+
7+
The following sections cover various **Alloy components** and how they can be utilized for logs, metrics, and traces:
8+
9+
- [Logs with Alloy](#1-logs-with-alloy)
10+
- [Metrics with Alloy](#2-metrics-with-alloy)
11+
- [Traces with Alloy](#3-traces-with-alloy)
12+
13+
### 1. Logs with Alloy
14+
In this section, we explore various ways to collect logs from different sources into Loki, focusing on the following types of logs:
15+
16+
#### Local Files Logs
17+
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.
18+
19+
- `local.file_match`: A component for identifying the local log files you want to monitor.
20+
- `loki.source.file`: The source component that reads the log files.
21+
- `loki.write`: Writes the logs from local files into Loki.
22+
23+
#### Systemd Journal Logs
24+
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.
25+
26+
- `loki.relabel`: A component to modify or filter the log labels before storing them.
27+
- `loki.source.journal`: Collects logs from the systemd journal.
28+
- `loki.write`: Writes the collected systemd journal logs into Loki.
29+
30+
#### Docker Container Logs
31+
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.
32+
33+
- `discovery.docker`: Discovers the running Docker containers.
34+
- `discovery.relabel`: Used to relabel the discovered container logs.
35+
- `loki.source.docker`: Collects logs from Docker containers.
36+
- `loki.write`: Writes the container logs into Loki.
37+
38+
#### Kubernetes Pod Logs
39+
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.
40+
41+
- `discovery.kubernetes`: Discovers the Kubernetes pods running in the cluster.
42+
- `discovery.relabel`: Relabels the pod logs based on specific rules.
43+
- `local.file_match`: Matches local files to collect logs from containers running within the pods.
44+
- `loki.source.file`: Collects logs from local files inside the pods.
45+
- `loki.process`: Processes the pod logs before writing them to Loki.
46+
- `loki.write`: Writes the Kubernetes pod logs into Loki.
47+
48+
For all related codes and configurations, [click here](./collecting-logs-from-loki).
49+
50+
---
51+
52+
### 2. Metrics with Alloy
53+
🚧 **Coming Soon:** This section will cover how to collect and analyze metrics using Alloy, one of its key components. Stay tuned for updates!
54+
55+
---
56+
57+
### 3. Traces with Alloy
58+
🚧 **Coming Soon:** This section will provide a detailed guide on collecting and visualizing traces using Alloy. Stay tuned for updates!

collecting-logs-with-alloy/kubernetes-podlogs-alloy-configmap.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ data:
5151
5252
loki.process "pod_logs" {
5353
stage.match {
54-
selector = "{namespace=~\"(ngin|ngim)x\"}"
54+
selector = "{namespace=~\"(my|your)app\"}"
5555
stage.regex {
5656
expression = "(?P<method>GET|PUT|DELETE|POST)"
5757
}

0 commit comments

Comments
 (0)