Skip to content

Commit afc6c10

Browse files
mhrdq8iJStickler
authored andcommitted
docs: Fix Some Typo (#15534)
Signed-off-by: Mehrdad; <[email protected]> Co-authored-by: J Stickler <[email protected]> (cherry picked from commit 46dc537)
1 parent 4fe706b commit afc6c10

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/sources/get-started/labels/_index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
menuTitle: Labels
33
title: Understand labels
4-
description: Explains how to Loki uses labels to define log streams.
4+
description: Explains how Loki uses labels to define log streams.
55
weight: 600
66
aliases:
77
- ../getting-started/labels/
88
- ../fundamentals/labels/
99
---
1010
# Understand labels
1111

12-
Labels are key value pairs and can be defined as anything! We like to refer to them as metadata to describe a log stream. If you are familiar with Prometheus, there are a few labels you are used to seeing like `job` and `instance`, and I will use those in the coming examples.
12+
Labels are key-value pairs and can be defined as anything! We like to refer to them as metadata to describe a log stream. If you are familiar with Prometheus, there are a few labels you are used to seeing like `job` and `instance`, and I will use those in the coming examples.
1313

1414
The scrape configs we provide with Grafana Loki define these labels, too. If you are using Prometheus, having consistent labels between Loki and Prometheus is one of Loki's superpowers, making it incredibly [easy to correlate your application metrics with your log data](/blog/2019/05/06/how-loki-correlates-metrics-and-logs--and-saves-you-money/).
1515

@@ -121,9 +121,9 @@ Now instead of a regex, we could do this:
121121
{env="dev"} <- will return all logs with env=dev, in this case this includes both log streams
122122
```
123123

124-
Hopefully now you are starting to see the power of labels. By using a single label, you can query many streams. By combining several different labels, you can create very flexible log queries.
124+
Hopefully, now you are starting to see the power of labels. By using a single label, you can query many streams. By combining several different labels, you can create very flexible log queries.
125125

126-
Labels are the index to Loki log data. They are used to find the compressed log content, which is stored separately as chunks. Every unique combination of label and values defines a stream, and logs for a stream are batched up, compressed, and stored as chunks.
126+
Labels are the index to Loki log data. They are used to find the compressed log content, which is stored separately as chunks. Every unique combination of labels and values defines a stream and logs for a stream are batched up, compressed, and stored as chunks.
127127

128128
For Loki to be efficient and cost-effective, we have to use labels responsibly. The next section will explore this in more detail.
129129

@@ -152,7 +152,7 @@ The two previous examples use statically defined labels with a single value; how
152152
__path__: /var/log/apache.log
153153
```
154154

155-
This regex matches every component of the log line and extracts the value of each component into a capture group. Inside the pipeline code, this data is placed in a temporary data structure that allows using it for several purposes during the processing of that log line (at which point that temp data is discarded). Much more detail about this can be found in the [Promtail pipelines]({{< relref "../../send-data/promtail/pipelines" >}}) documentation.
155+
This regex matches every component of the log line and extracts the value of each component into a capture group. Inside the pipeline code, this data is placed in a temporary data structure that allows use for several purposes during the processing of that log line (at which point that temp data is discarded). Much more detail about this can be found in the [Promtail pipelines]({{< relref "../../send-data/promtail/pipelines" >}}) documentation.
156156

157157
From that regex, we will be using two of the capture groups to dynamically set two labels based on content from the log line itself:
158158

@@ -180,13 +180,13 @@ In Loki the following streams would be created:
180180

181181
Those four log lines would become four separate streams and start filling four separate chunks.
182182

183-
Any additional log lines that match those combinations of label/values would be added to the existing stream. If another unique combination of labels comes in (for example, `status_code="500"`) another new stream is created.
183+
Any additional log lines that match those combinations of labels/values would be added to the existing stream. If another unique combination of labels comes in (for example, `status_code="500"`) another new stream is created.
184184

185185
Imagine now if you set a label for `ip`. Not only does every request from a user become a unique stream. Every request with a different action or status_code from the same user will get its own stream.
186186

187187
Doing some quick math, if there are maybe four common actions (GET, PUT, POST, DELETE) and maybe four common status codes (although there could be more than four!), this would be 16 streams and 16 separate chunks. Now multiply this by every user if we use a label for `ip`. You can quickly have thousands or tens of thousands of streams.
188188

189-
This is high cardinality, and it can lead to significant performance degredation.
189+
This is high cardinality, and it can lead to significant performance degradation.
190190

191191
When we talk about _cardinality_ we are referring to the combination of labels and values and the number of streams they create. High cardinality is using labels with a large range of possible values, such as `ip`, **or** combining many labels, even if they have a small and finite set of values, such as using `status_code` and `action`.
192192

@@ -216,7 +216,7 @@ To see how this works, let's look back at our example of querying your access lo
216216
217217
Behind the scenes, Loki will break up that query into smaller pieces (shards), and open up each chunk for the streams matched by the labels and start looking for this IP address.
218218
219-
The size of those shards and the amount of parallelization is configurable and based on the resources you provision. If you want to, you can configure the shard interval down to 5m, deploy 20 queriers, and process gigabytes of logs in seconds. Or you can go crazy and provision 200 queriers and process terabytes of logs!
219+
The size of those shards and the amount of parallelization are configurable and based on the resources you provision. If you want to, you can configure the shard interval down to 5m, deploy 20 queriers, and process gigabytes of logs in seconds. Or you can go crazy and provision 200 queriers and process terabytes of logs!
220220
221221
This trade-off of smaller index and parallel brute force querying vs. a larger/faster full-text index is what allows Loki to save on costs versus other systems. The cost and complexity of operating a large index is high and is typically fixed -- you pay for it 24 hours a day if you are querying it or not.
222222

0 commit comments

Comments
 (0)