Menu
Open source
sampling
The sampling
stage is a stage that sampling logs.
Sampling stage schema
The sampling
stage is used to sampling the logs. Configuring the value rate: 0.1
means that 10% of the logs will be pushed to the Loki server.
yaml
sampling:
# The rate sampling in lines per second that Promtail will push to Loki.The value is between 0 and 1, where a value of 0 means no logs are sampled and a value of 1 means 100% of logs are sampled.
[rate: <int>]
Examples
The following are examples showing the use of the sampling
stage.
sampling
Simple sampling
Given the pipeline:
yaml
- sampling:
rate: 0.1
Match a line and sampling
Given the pipeline:
yaml
pipeline_stages:
- json:
expressions:
app:
- match:
pipeline_name: "app2"
selector: "{app="poki"}"
stages:
- sampling:
rate: 0.1
Complex sampling
stage configurations.
Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:

Getting started with logging and Grafana Loki
See a demo of the updated features in Loki, and how to create metrics from logs and alert on your logs with powerful Prometheus-style alerting rules.

Essential Grafana Loki configuration settings
This webinar focuses on Grafana Loki configuration including agents Promtail and Docker; the Loki server; and Loki storage for popular backends.

Scaling and securing your logs with Grafana Loki
This webinar covers the challenges of scaling and securing logs, and how Grafana Enterprise Logs powered by Grafana Loki can help, cost-effectively.