Skip to content

Commit

Permalink
Update notes to use shortcode (#11408)
Browse files Browse the repository at this point in the history
**What this PR does / why we need it**:
Updates Notes to use the Hugo admonition shortcode.

**Which issue(s) this PR fixes**:
Replaces PR #9409 which has gone stale.
  • Loading branch information
JStickler authored Dec 8, 2023
1 parent ee008cf commit 5e34967
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 29 deletions.
12 changes: 9 additions & 3 deletions docs/sources/alert/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,22 @@ Another great use case is alerting on high cardinality sources. These are things

Creating these alerts in LogQL is attractive because these metrics can be extracted at _query time_, meaning we don't suffer the cardinality explosion in our metrics store.

> **Note** As an example, we can use LogQL v2 to help Loki to monitor _itself_, alerting us when specific tenants have queries that take longer than 10s to complete! To do so, we'd use the following query: `sum by (org_id) (rate({job="loki-prod/query-frontend"} |= "metrics.go" | logfmt | duration > 10s [1m]))`
{{% admonition type="note" %}}
As an example, we can use LogQL v2 to help Loki to monitor _itself_, alerting us when specific tenants have queries that take longer than 10s to complete! To do so, we'd use the following query: `sum by (org_id) (rate({job="loki-prod/query-frontend"} |= "metrics.go" | logfmt | duration > 10s [1m])
{{% /admonition %}}`.

## Interacting with the Ruler

### Cortextool
Because the rule files are identical to Prometheus rule files, we can interact with the Loki Ruler via [`cortextool`](https://github.com/grafana/cortex-tools#rules). The CLI is in early development, but it works with both Loki and Cortex. Pass the `--backend=loki` option when using it with Loki.

> **Note:** Not all commands in cortextool currently support Loki.
{{% admonition type="note" %}}
Not all commands in cortextool currently support Loki.
{{% /admonition %}}

> **Note:** cortextool was intended to run against multi-tenant Loki, commands need an `--id=` flag set to the Loki instance ID or set the environment variable `CORTEX_TENANT_ID`. If Loki is running in single tenant mode, the required ID is `fake` (yes we know this might seem alarming but it's totally fine, no it can't be changed)
{{% admonition type="note" %}}
cortextool was intended to run against multi-tenant Loki, commands need an `--id=` flag set to the Loki instance ID or set the environment variable `CORTEX_TENANT_ID`. If Loki is running in single tenant mode, the required ID is `fake`.
{{% /admonition %}}

An example workflow is included below:

Expand Down
7 changes: 5 additions & 2 deletions docs/sources/operations/automatic-stream-sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ per-stream rate limit.
shard_streams:
enabled: true
```
2. Optionally lower the `desired_rate` in bytes if you find that the system is still hitting the `per_stream_rate_limit`:
1. Optionally lower the `desired_rate` in bytes if you find that the system is still hitting the `per_stream_rate_limit`:
```yaml
limits_config:
shard_streams:
enabled: true
desired_rate: 2097152 #2MiB
```
3. Optionally enable `logging_enabled` for debugging stream sharding. **Note**: this may affect the ingestion performance of Loki.
1. Optionally enable `logging_enabled` for debugging stream sharding.
{{% admonition type="note" %}}
This may affect the ingestion performance of Loki.
{{% /admonition %}}
```yaml
limits_config:
shard_streams:
Expand Down
4 changes: 3 additions & 1 deletion docs/sources/operations/scalability.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ this will result in far lower `ruler` resource usage because the majority of the
The LogQL queries coming from the `ruler` will be executed against the given `query-frontend` service.
Requests will be load-balanced across all `query-frontend` IPs if the `dns:///` prefix is used.

> **Note:** Queries that fail to execute are _not_ retried.
{{% admonition type="note" %}}
Queries that fail to execute are _not_ retried.
{{% /admonition %}}

### Limits and Observability

Expand Down
4 changes: 3 additions & 1 deletion docs/sources/operations/storage/logs-deletion.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ Log entry deletion relies on configuration of the custom logs retention workflow
Enable log entry deletion by setting `retention_enabled` to true in the compactor's configuration and setting and `deletion_mode` to `filter-only` or `filter-and-delete` in the runtime config.
`delete_request_store` also needs to be configured when retention is enabled to process delete requests, this determines the storage bucket that stores the delete requests.

> **Warning:** Be very careful when enabling retention. It is strongly recommended that you also enable versioning on your objects in object storage to allow you to recover from accidental misconfiguration of a retention setting. If you want to enable deletion but not not want to enforce retention, configure the `retention_period` setting with a value of `0s`.
{{% admonition type="warning" %}}
Be very careful when enabling retention. It is strongly recommended that you also enable versioning on your objects in object storage to allow you to recover from accidental misconfiguration of a retention setting. If you want to enable deletion but not not want to enforce retention, configure the `retention_period` setting with a value of `0s`.
{{% /admonition %}}

Because it is a runtime configuration, `deletion_mode` can be set per-tenant, if desired.

Expand Down
9 changes: 7 additions & 2 deletions docs/sources/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ weight: 100
Loki exposes an HTTP API for pushing, querying, and tailing log data, as well
as for viewing and managing cluster information.

**Note that authorization is not part of the Loki API.**
{{% admonition type="note" %}}
Note that authorization is not part of the Loki API.
Authorization needs to be done separately, for example, using an open-source load-balancer such as NGINX.
{{% /admonition %}}

## Endpoints

Expand Down Expand Up @@ -1291,7 +1293,10 @@ DELETE /loki/api/v1/delete
Query parameters:

- `request_id=<request_id>`: Identifies the delete request to cancel; IDs are found using the `delete` endpoint.
- `force=<boolean>`: When the `force` query parameter is true, partially completed delete requests will be canceled. NOTE: some data from the request may still be deleted and the deleted request will be listed as 'processed'
- `force=<boolean>`: When the `force` query parameter is true, partially completed delete requests will be canceled.
{{% admonition type="note" %}}
some data from the request may still be deleted and the deleted request will be listed as 'processed'.
{{% /admonition %}}

A 204 response indicates success.

Expand Down
4 changes: 3 additions & 1 deletion docs/sources/release-notes/cadence.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ naming scheme: `MAJOR`.`MINOR`.`PATCH`.
- `MINOR` (roughly once a quarter): these releases include new features which generally do not break backwards-compatibility, but from time to time we might introduce _minor_ breaking changes, and we will specify these in our upgrade docs.
- `PATCH` (roughly once or twice a month): these releases include bug and security fixes which do not break backwards-compatibility.

> **NOTE:** While our naming scheme resembles [Semantic Versioning](https://semver.org/), at this time we do not strictly follow its
{{% admonition type="note" %}}
While our naming scheme resembles [Semantic Versioning](https://semver.org/), at this time we do not strictly follow its
guidelines to the letter. Our goal is to provide regular releases that are as stable as possible, and we take backwards-compatibility
seriously. As with any software, always read the [release notes](/release-notes) and the [upgrade guide](/upgrading) whenever
choosing a new version of Loki to install.
{{% /admonition %}}

New releases are based of a [weekly release](#weekly-releases) which we have vetted for stability over a number of weeks.

Expand Down
4 changes: 2 additions & 2 deletions docs/sources/release-notes/v2-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ List of security fixes for 2.3.x.

* [4020](https://github.com/grafana/loki/pull/4020) **simonswine**: Restrict path segments in TenantIDs (CVE-2021-36156 CVE-2021-36157).

**Note** Exploitation of this vulnerability requires the ability for an attacker to craft and send directly to Loki an `X-Scope-OrgID` header, end users should not have the ability to create and send this header directly to Loki as it controls access to tenants and is important to control setting of this header for proper tenant isolation and security. We always recommend having a proxy or gateway be responsible for setting the `X-Scope-OrgID`.

{{% admonition type="note" %}}
Exploitation of this vulnerability requires the ability for an attacker to craft and send directly to Loki an `X-Scope-OrgID` header, end users should not have the ability to create and send this header directly to Loki as it controls access to tenants and is important to control setting of this header for proper tenant isolation and security. We always recommend having a proxy or gateway be responsible for setting the `X-Scope-OrgID`.{{% /admonition %}}

## Bug fixes

Expand Down
24 changes: 14 additions & 10 deletions docs/sources/send-data/docker-driver/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ docker run --log-driver=loki \
--log-opt loki-batch-size=400 \
grafana/grafana
```

> **Note**: The Loki logging driver still uses the json-log driver in combination with sending logs to Loki, this is mainly useful to keep the `docker logs` command working.
> You can adjust file size and rotation using the respective log option `max-size` and `max-file`. Keep in mind that default values for these options are not taken from json-log configuration.
> You can deactivate this behavior by setting the log option `no-file` to true.
{{% admonition type="note" %}}
The Loki logging driver still uses the json-log driver in combination with sending logs to Loki, this is mainly useful to keep the `docker logs` command working.
You can adjust file size and rotation using the respective log option `max-size` and `max-file`. Keep in mind that default values for these options are not taken from json-log configuration.
You can deactivate this behavior by setting the log option `no-file` to true.
{{% /admonition %}}

## Change the default logging driver

Expand Down Expand Up @@ -64,10 +65,11 @@ Options for the logging driver can also be configured with `log-opts` in the
}
}
```

> **Note**: log-opt configuration options in daemon.json must be provided as
{{% admonition type="note" %}}
log-opt configuration options in daemon.json must be provided as
> strings. Boolean and numeric values (such as the value for loki-batch-size in
> the example above) must therefore be enclosed in quotes (`"`).
{{% /admonition %}}

After changing `daemon.json`, restart the Docker daemon for the changes to take
effect. All **newly created** containers from that host will then send logs to Loki via the driver.
Expand Down Expand Up @@ -102,9 +104,9 @@ docker-compose -f docker-compose.yaml up

Once deployed, the Grafana service will send its logs to Loki.

> **Note**: stack name and service name for each swarm service and project name
> and service name for each compose service are automatically discovered and
> sent as Loki labels, this way you can filter by them in Grafana.
{{% admonition type="note" %}}
Stack name and service name for each swarm service and project name and service name for each compose service are automatically discovered and sent as Loki labels, this way you can filter by them in Grafana.
{{% /admonition %}}

## Labels

Expand Down Expand Up @@ -148,7 +150,9 @@ services:
- "3000:3000"
```
> Note the `loki-pipeline-stages: |` allowing to keep the indentation correct.
{{% admonition type="note" %}}
Note the `loki-pipeline-stages: |` letting you keep the indentation correct.
{{% /admonition %}}

When using docker run you can also pass the value via a string parameter like such:

Expand Down
4 changes: 3 additions & 1 deletion docs/sources/send-data/fluentd/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ services:
## Usage
**Note**: use either `<label>...</label>` or `extra_labels` to set at least one label.
{{% admonition type="note" %}}
Use either `<label>...</label>` or `extra_labels` to set at least one label.
{{% /admonition %}}

In your Fluentd configuration, add `@type loki`. Additional configuration is optional. Default values would look like this:

Expand Down
10 changes: 7 additions & 3 deletions docs/sources/send-data/promtail/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ ${VAR:-default_value}

Where default_value is the value to use if the environment variable is undefined.

**Note**: With `expand-env=true` the configuration will first run through
{{% admonition type="note" %}}
With `expand-env=true` the configuration will first run through
[envsubst](https://pkg.go.dev/github.com/drone/envsubst) which will replace double
backslashes with single backslashes. Because of this every use of a backslash `\` needs to
be replaced with a double backslash `\\`
be replaced with a double backslash `\\`.
{{% /admonition %}}

### Generic placeholders

Expand Down Expand Up @@ -848,7 +850,9 @@ labels:
[path: <string>]
```

**Note**: priority label is available as both value and keyword. For example, if `priority` is `3` then the labels will be `__journal_priority` with a value `3` and `__journal_priority_keyword` with a corresponding keyword `err`.
{{% admonition type="note" %}}
Priority label is available as both value and keyword. For example, if `priority` is `3` then the labels will be `__journal_priority` with a value `3` and `__journal_priority_keyword` with a corresponding keyword `err`.
{{% /admonition %}}

### syslog

Expand Down
12 changes: 9 additions & 3 deletions docs/sources/send-data/promtail/logrotation/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ At any point in time, there may be three processes working on a log file as show
2. Tailer - A reader that reads log lines as they are appended, for example, agents like Promtail.
3. Log Rotator - A process that rotates the log file either based on time (for example, scheduled every day) or size (for example, a log file reached its maximum size).

> **NOTE:** Here `fd` defines a file descriptor. Once a file is open for read or write, The Operating System returns a unique file descriptor (usually an integer) per process, and all the operations like read and write are done over that file descriptor. In other words, once the file is opened successfully, the file descriptor matters more than the file name.
{{% admonition type="note" %}}
Here `fd` defines a file descriptor. Once a file is open for read or write, The Operating System returns a unique file descriptor (usually an integer) per process, and all the operations like read and write are done over that file descriptor. In other words, once the file is opened successfully, the file descriptor matters more than the file name.
{{% /admonition %}}

One of the critical components here is the log rotator. Let's understand how it impacts other components like the appender and tailer.

Expand Down Expand Up @@ -96,7 +98,9 @@ You can [configure](https://kubernetes.io/docs/concepts/cluster-administration/l

Both should be part of the `kubelet` config. If you run a managed version of Kubernetes in Cloud, refer to your cloud provider documentation for configuring `kubelet`. Examples [GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/node-system-config#create), [AKS](https://learn.microsoft.com/en-us/azure/aks/custom-node-configuration#use-custom-node-configuration) and [EKS](https://eksctl.io/usage/customizing-the-kubelet/#customizing-kubelet-configuration).

> **NOTE:** Log rotation managed by `kubelet` supports only rename + create and doesn't support copy + truncate.
{{% admonition type="note" %}}
Log rotation managed by `kubelet` supports only rename + create and doesn't support copy + truncate.
{{% /admonition %}}

If `kubelet` is not configured to manage the log rotation, then it's up to the Container Runtime Interface (CRI) the cluster uses. Alternatively, log rotation can be managed by the `logrotate` utility in the Kubernetes node itself.

Expand Down Expand Up @@ -138,7 +142,9 @@ Example `/etc/docker/daemon.json`:

If neither `kubelet` nor `CRI` is configured for rotating logs, then the `logrotate` utility can be used on the Kubernetes nodes as explained previously.

> **NOTE:** We recommend using kubelet for log rotation.
{{% admonition type="note" %}}
We recommend using kubelet for log rotation.
{{% /admonition %}}

## Configure Promtail

Expand Down

0 comments on commit 5e34967

Please sign in to comment.