https://github.com/opsgy/loki-rule-operator
Kubernetes Operator that helps configuring Alert rules for your Loki setup.
https://github.com/opsgy/loki-rule-operator
Last synced: 3 months ago
JSON representation
Kubernetes Operator that helps configuring Alert rules for your Loki setup.
- Host: GitHub
- URL: https://github.com/opsgy/loki-rule-operator
- Owner: opsgy
- License: apache-2.0
- Created: 2021-02-27T22:40:25.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-29T14:07:27.000Z (about 1 year ago)
- Last Synced: 2024-08-05T08:08:42.577Z (7 months ago)
- Language: Go
- Size: 19.4 MB
- Stars: 32
- Watchers: 3
- Forks: 13
- Open Issues: 7
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# loki-rule-operator
Loki-rule-operator is light-weight Kubernetes Operator that adds the `LokiRule` and `GlobalLokiRule` Custom Resource Definitions to a cluster. These resources helps configuring [Alert rules](https://grafana.com/docs/loki/latest/alerting/) for your [Loki setup](https://grafana.com/docs/loki/latest/installation/).## Example
```yaml
apiVersion: logging.opsgy.com/v1beta1
kind: LokiRule
metadata:
name: credentials-leak
namespace: prod
spec:
groups:
- name: credentials_leak
rules:
- alert: http-credentials-leaked
annotations:
message: '{{ $labels.job }} is leaking http basic auth credentials.'
expr: sum by (cluster, job, pod) (count_over_time({namespace="prod"} |~ "http(s?)://(\\w+):(\\w+)@" [5m]) > 0)
for: 10m
labels:
severity: critical
```## Difference between `GlobalLokiRule` and `LokiRule`
`LokiRule` is a namespaced resource and will will enforce the selector `{namespace=""}` on the LogQL expression. The `GlobalLokiRule` is cluster wide and doesn't enforce the namespace selector.## Setup the loki-rule-operator
See the [deploy](./deploy) folder.## License
Apache License 2.0, see [LICENSE](LICENSE).