Skip to content

Commit 37dfdb0

Browse files
authored
Merge branch 'main' into fix/default-data-location-7748
2 parents 73eab8c + de1a5a6 commit 37dfdb0

File tree

184 files changed

+9778
-17958
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+9778
-17958
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,5 @@ mem.prof
7474
*.pprof
7575

7676
**/.claude/settings.local.json
77+
78+
host-*.json

cmd/loki/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ import (
88
"runtime"
99
"time"
1010

11+
// The go.opentelemetry.io/collector/pdata/internal/grpcencoding package
12+
// registers its own encoding for proto, falling back to the existing proto
13+
// encoding for non-OTLP messages.
14+
//
15+
// However, if no proto encoding has been registered, the fallback mechanism
16+
// will panic. This can happen depending on import order, as encodings are
17+
// registered via init functions. To avoid this, we force the correct import
18+
// order by keeping this as the very first import.
19+
//
20+
// This import can be removed once the grpcencoding package includes this
21+
// import itself.
22+
_ "google.golang.org/grpc/encoding/proto"
23+
1124
"github.com/go-kit/log/level"
1225
"github.com/grafana/dskit/log"
1326
"github.com/grafana/dskit/tracing"

cmd/querytee/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func main() {
4242
trace, err := tracing.NewOTelOrJaegerFromEnv("loki-querytee", util_log.Logger)
4343
if err != nil {
4444
level.Error(util_log.Logger).Log("msg", "error in initializing tracing. tracing will not be enabled", "err", err)
45+
os.Exit(1)
4546
}
4647

4748
defer func() {

docs/sources/operations/blocking-queries.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ overrides:
3434
# block any query that matches this query hash
3535
- hash: 2943214005 # hash of {stream="stdout",pod="loki-canary-9w49x"}
3636
types: filter,limited
37+
38+
# block queries originating from specific sources via X-Query-Tags
39+
# Keys and values are matched case-insensitively.
40+
- pattern: '.*' # optional; if pattern and regex are omittied they will default to '.*' and true
41+
regex: true
42+
tags:
43+
source: grafana
44+
feature: beta
3745
```
3846
{{< admonition type="note" >}}
3947
Changes to these configurations **do not require a restart**; they are defined in the [runtime configuration file](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#runtime-configuration-file).
@@ -61,6 +69,48 @@ The order of patterns is preserved, so the first matching pattern will be used.
6169

6270
Blocked queries are logged, as well as counted in the `loki_blocked_queries` metric on a per-tenant basis.
6371

72+
When a policy matches by pattern/hash/regex, Loki logs whether the query type and request tags matched that policy:
73+
74+
```logfmt
75+
level=warn msg="query blocker matched with regex policy" user=29 type=metric pattern=".*rate\\(.*\\).*" query="sum(rate({app=\"foo\"}[5m]))" typesMatched=true tagsMatched=false blocked=false
76+
```
77+
78+
If tag constraints fail to match, Loki emits a debug log showing the missing key and the raw header value that was received:
79+
80+
```logfmt
81+
level=debug msg="query blocker tags mismatch: missing or mismatched key" key=feature tagsRaw="Source=grafana,Feature=alpha"
82+
```
83+
6484
## Scope
6585

6686
Queries received via the API and executed as [alerting/recording rules](../../alert/) will be blocked.
87+
88+
## Tag-based blocking
89+
90+
You can scope a blocked query rule to requests that include specific key=value pairs in the `X-Query-Tags` header.
91+
92+
- Header format: `key=value` pairs separated by commas, for example: `Source=grafana,Feature=beta`.
93+
- Allowed characters are alphanumeric plus space, comma, equals, '@', '.', and '-'. Any other characters are replaced with `_`.
94+
- Parsing keeps only canonical `key=value` tokens; malformed tokens are ignored.
95+
- Matching rules:
96+
- Keys are matched case-insensitively (the server lowercases keys).
97+
- Values are matched case-insensitively.
98+
- All specified `tags:` pairs in the rule must be present in the request to apply the block.
99+
100+
Examples:
101+
102+
```yaml
103+
overrides:
104+
tenant-a:
105+
blocked_queries:
106+
# Block only metric queries from a beta feature flag
107+
- types: metric
108+
tags:
109+
feature: beta
110+
111+
# Combine with regex to narrow scope further
112+
- pattern: '.*rate\\(.*\\).*'
113+
regex: true
114+
tags:
115+
source: grafana
116+
```

docs/sources/setup/install/docker.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: Install Loki with Docker or Docker Compose
3-
menuTitle: Install using Docker
3+
menuTitle: Install using Docker
44
description: Describes how to install Loki using Docker or Docker Compose
55
aliases:
66
- ../../installation/docker/
77
weight: 400
88
---
99
# Install Loki with Docker or Docker Compose
1010

11-
You can install Loki and Promtail with Docker or Docker Compose if you are evaluating, testing, or developing Loki.
11+
You can install Loki and Alloy with Docker or Docker Compose if you are evaluating, testing, or developing Loki.
1212
For production, Grafana recommends installing with Helm or Tanka.
1313

1414
The configuration files associated with these installation instructions run Loki as a single binary.
@@ -27,18 +27,18 @@ The configuration files associated with these installation instructions run Loki
2727
cd loki
2828
```
2929

30-
1. Copy and paste the following commands into your command line to download `loki-local-config.yaml` and `promtail-docker-config.yaml` to your `loki` directory.
30+
1. Copy and paste the following commands into your command line to download `loki-local-config.yaml` and `promtail-docker-config.yaml` to your `loki` directory. If necessary, update the Loki version numbers in the commands to match your version of Loki.
3131

3232
```bash
33-
wget https://raw.githubusercontent.com/grafana/loki/v3.4.1/cmd/loki/loki-local-config.yaml -O loki-config.yaml
34-
wget https://raw.githubusercontent.com/grafana/loki/v3.4.1/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml
33+
wget https://raw.githubusercontent.com/grafana/loki/v3.5.7/cmd/loki/loki-local-config.yaml -O loki-config.yaml
34+
wget https://raw.githubusercontent.com/grafana/loki/v3.5.7/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml
3535
```
3636

37-
1. Copy and paste the following commands into your command line to start the Docker containers using the configuration files you downloaded in the previous step.
37+
1. Copy and paste the following commands into your command line to start the Docker containers using the configuration files you downloaded in the previous step. If necessary, update the Loki version numbers in the commands to match your version of Loki.
3838

3939
```bash
40-
docker run --name loki -d -v $(pwd):/mnt/config -p 3100:3100 grafana/loki:3.4.1 -config.file=/mnt/config/loki-config.yaml
41-
docker run --name promtail -d -v $(pwd):/mnt/config -v /var/log:/var/log --link loki grafana/promtail:3.4.1 -config.file=/mnt/config/promtail-config.yaml
40+
docker run --name loki -d -v $(pwd):/mnt/config -p 3100:3100 grafana/loki:3.5.7 -config.file=/mnt/config/loki-config.yaml
41+
docker run --name promtail -d -v $(pwd):/mnt/config -v /var/log:/var/log --link loki grafana/promtail:3.5.7 -config.file=/mnt/config/promtail-config.yaml
4242
```
4343

4444
{{< admonition type="note" >}}
@@ -56,8 +56,8 @@ The configuration files associated with these installation instructions run Loki
5656
```bash
5757
5858
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
59-
9485de9ad351 grafana/promtail:3.4.1 "/usr/bin/promtail -…" About a minute ago Up About a minute promtail
60-
cece1df84519 grafana/loki:3.4.1 "/usr/bin/loki -conf…" About a minute ago Up About a minute 0.0.0.0:3100->3100/tcp, :::3100->3100/tcp loki
59+
9485de9ad351 grafana/promtail:3.5.7 "/usr/bin/promtail -…" About a minute ago Up About a minute promtail
60+
cece1df84519 grafana/loki:3.5.7 "/usr/bin/loki -conf…" About a minute ago Up About a minute 0.0.0.0:3100->3100/tcp, :::3100->3100/tcp loki
6161
```
6262

6363
1. Verify that Loki is up and running.
@@ -67,19 +67,19 @@ The configuration files associated with these installation instructions run Loki
6767

6868
## Install with Docker on Windows
6969

70-
1. Copy and paste the following commands into your command line to download `loki-local-config.yaml` and `promtail-docker-config.yaml` to your `loki` directory. Note that you will need to replace the `<local-path>` in the commands with your local path.
70+
1. Copy and paste the following commands into your command line to download `loki-local-config.yaml` and `promtail-docker-config.yaml` to your `loki` directory. Note that you will need to replace the `<local-path>` in the commands with your local path. If necessary, update the Loki version numbers in the commands to match your version of Loki.
7171

7272
```bash
7373
cd "<local-path>"
74-
wget https://raw.githubusercontent.com/grafana/loki/v3.4.1/cmd/loki/loki-local-config.yaml -O loki-config.yaml
75-
wget https://raw.githubusercontent.com/grafana/loki/v3.4.1/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml
74+
wget https://raw.githubusercontent.com/grafana/loki/v3.5.7/cmd/loki/loki-local-config.yaml -O loki-config.yaml
75+
wget https://raw.githubusercontent.com/grafana/loki/v3.5.7/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml
7676
```
7777

78-
1. Copy and paste the following commands into your command line to start the Docker containers using the configuration files you downloaded in the previous step. Note that you will need to replace the `<local-path>` in the commands with your local path.
78+
1. Copy and paste the following commands into your command line to start the Docker containers using the configuration files you downloaded in the previous step. Note that you will need to replace the `<local-path>` in the commands with your local path. If necessary, update the Loki version numbers in the commands to match your version of Loki.
7979

8080
```bash
81-
docker run --name loki -v <local-path>:/mnt/config -p 3100:3100 grafana/loki:3.4.1 --config.file=/mnt/config/loki-config.yaml
82-
docker run -v <local-path>:/mnt/config -v /var/log:/var/log --link loki grafana/promtail:3.4.1 --config.file=/mnt/config/promtail-config.yaml
81+
docker run --name loki -v <local-path>:/mnt/config -p 3100:3100 grafana/loki:3.5.7 --config.file=/mnt/config/loki-config.yaml
82+
docker run -v <local-path>:/mnt/config -v /var/log:/var/log --link loki grafana/promtail:3.5.7 --config.file=/mnt/config/promtail-config.yaml
8383
```
8484

8585
1. Verify that Loki is up and running.
@@ -98,10 +98,12 @@ Run the following commands in your command line. They work for Windows or Linux
9898
cd loki
9999
```
100100

101-
1. Copy and paste the following command into your command line to download the `docker-compose` file.
101+
1. Copy and paste the following commands into your command line to download the `docker-compose.yaml` and `alloy-local-config.yaml` files. If necessary, update the Loki version numbers in the commands to match your version of Loki.
102102

103103
```bash
104-
wget https://raw.githubusercontent.com/grafana/loki/v3.4.1/production/docker-compose.yaml -O docker-compose.yaml
104+
wget https://raw.githubusercontent.com/grafana/loki/v3.5.7/examples/getting-started/docker-compose.yaml -O docker-compose.yaml
105+
wget https://raw.githubusercontent.com/grafana/loki/v3.5.7/examples/getting-started/alloy-local-config.yaml -O alloy-local-config.yaml
106+
wget https://raw.githubusercontent.com/grafana/loki/v3.5.7/examples/getting-started/loki-config.yaml -O loki-config.yaml
105107
```
106108

107109
1. With `loki` as the current working directory, run the following 'docker-compose` command:
@@ -115,7 +117,7 @@ Run the following commands in your command line. They work for Windows or Linux
115117
```bash
116118
✔ Container loki-loki-1 Started 0.0s
117119
✔ Container loki-grafana-1 Started 0.0s
118-
✔ Container loki-promtail-1 Started 0.0s
120+
✔ Container loki-alloy-1 Started 0.0s
119121
```
120122
121123
1. Verify that Loki is up and running.

docs/sources/setup/install/helm/reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3913,7 +3913,7 @@ null
39133913
"pullPolicy": "IfNotPresent",
39143914
"registry": "docker.io",
39153915
"repository": "grafana/enterprise-logs",
3916-
"tag": "3.5.5"
3916+
"tag": "3.5.7"
39173917
},
39183918
"license": {
39193919
"contents": "NOTAVALIDLICENSE"
@@ -4060,7 +4060,7 @@ null
40604060
<td>string</td>
40614061
<td>Docker image tag</td>
40624062
<td><pre lang="json">
4063-
"3.5.5"
4063+
"3.5.7"
40644064
</pre>
40654065
</td>
40664066
</tr>

0 commit comments

Comments
 (0)