diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 9006cf2ce7b09..0000000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,79 +0,0 @@ -version: 2 - -.tags: &tags # tags need to be explicitly defined (whitelist) - tags: { only: "/.*/" } - -.only-tags: &only-tags - <<: *tags - branches: { ignore: "/.*/" } - -.tag-or-main: &tag-or-main - branches: { only: main } - <<: *tags - -.no-main: &no-main # contrary to tags, the branches must be excluded - branches: { ignore: main } - -workflows: - version: 2 - default: - jobs: - # publish jobs depend on this as well, - # thus tags need to be allowed for these - - test: { filters: { <<: *tags } } - - - build/promtail-windows: - requires: [test] - - - build/docker-driver: - requires: [test] - filters: { <<: *no-main } - - publish/docker-driver: - requires: [test] - filters: { <<: *tag-or-main } - - -# https://circleci.com/blog/circleci-hacks-reuse-yaml-in-your-circleci-config-with-yaml/ -.defaults: &defaults - docker: - - image: grafana/loki-build-image:0.25.0 - working_directory: /src/loki - -jobs: - test: - <<: *defaults - steps: - - checkout - - # Promtail - build/promtail-windows: - <<: *defaults - steps: - - checkout - - setup_remote_docker - - run: - name: build - command: make GOOS=windows GOGC=10 promtail - - # Docker driver - build/docker-driver: - <<: *defaults - steps: - - checkout - - setup_remote_docker - - run: - name: docker-driver - command: make docker-driver - - publish/docker-driver: - <<: *defaults - steps: - - checkout - - setup_remote_docker - - run: - name: login - command: docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" - - run: - name: docker-driver - command: make docker-driver-push - diff --git a/.drone/drone.jsonnet b/.drone/drone.jsonnet index 41fc42c08b3fe..8fbab4dbfce5b 100644 --- a/.drone/drone.jsonnet +++ b/.drone/drone.jsonnet @@ -548,6 +548,7 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { commands: ['apk add make bash && make lint-scripts'], }, make('loki', container=false) { depends_on: ['check-generated-files'] }, + make('check-doc', container=false) { depends_on: ['loki'] }, make('validate-example-configs', container=false) { depends_on: ['loki'] }, make('check-example-config-doc', container=false) { depends_on: ['clone'] }, ], @@ -617,7 +618,7 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') { fluentd(), logstash(), querytee(), - manifest(['promtail', 'loki', 'loki-canary']) { + manifest(['promtail', 'loki', 'loki-canary', 'loki-operator']) { trigger+: onTagOrMain, }, pipeline('deploy') { diff --git a/.drone/drone.yml b/.drone/drone.yml index f86de6af6c551..9d969d152c0ea 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -93,14 +93,14 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: check-drone-drift - commands: - make BUILD_IN_CONTAINER=false check-generated-files depends_on: - clone environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: check-generated-files - commands: - cd .. @@ -110,7 +110,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: clone-target-branch when: event: @@ -121,7 +121,7 @@ steps: - clone-target-branch - check-generated-files environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: test - commands: - cd ../loki-target-branch @@ -129,7 +129,7 @@ steps: depends_on: - clone-target-branch environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: test-target-branch when: event: @@ -142,7 +142,7 @@ steps: - test - test-target-branch environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: compare-coverage when: event: @@ -158,7 +158,7 @@ steps: TOKEN: from_secret: github_token USER: grafanabot - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: report-coverage when: event: @@ -168,7 +168,7 @@ steps: depends_on: - check-generated-files environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: lint - commands: - make BUILD_IN_CONTAINER=false check-mod @@ -176,7 +176,7 @@ steps: - test - lint environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: check-mod - commands: - apk add make bash && make lint-scripts @@ -187,21 +187,28 @@ steps: depends_on: - check-generated-files environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: loki +- commands: + - make BUILD_IN_CONTAINER=false check-doc + depends_on: + - loki + environment: {} + image: grafana/loki-build-image:0.26.0 + name: check-doc - commands: - make BUILD_IN_CONTAINER=false validate-example-configs depends_on: - loki environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: validate-example-configs - commands: - make BUILD_IN_CONTAINER=false check-example-config-doc depends_on: - clone environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: check-example-config-doc trigger: ref: @@ -228,7 +235,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: loki-mixin-check when: event: @@ -253,7 +260,7 @@ steps: depends_on: - clone environment: {} - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: documentation-helm-reference-check trigger: ref: @@ -1185,6 +1192,19 @@ steps: target: loki-canary username: from_secret: docker_username +- depends_on: + - clone + - manifest-loki-canary + image: plugins/manifest + name: manifest-loki-operator + settings: + ignore_missing: false + password: + from_secret: docker_password + spec: .drone/docker-manifest.tmpl + target: loki-operator + username: + from_secret: docker_username trigger: event: - push @@ -1340,7 +1360,7 @@ steps: NFPM_SIGNING_KEY: from_secret: gpg_private_key NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: write-key - commands: - make BUILD_IN_CONTAINER=false packages @@ -1348,7 +1368,7 @@ steps: NFPM_PASSPHRASE: from_secret: gpg_passphrase NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: test packaging - commands: - ./tools/packaging/verify-deb-install.sh @@ -1374,7 +1394,7 @@ steps: NFPM_PASSPHRASE: from_secret: gpg_passphrase NFPM_SIGNING_KEY_FILE: /drone/src/private-key.key - image: grafana/loki-build-image:0.25.0 + image: grafana/loki-build-image:0.26.0 name: publish when: event: @@ -1613,6 +1633,6 @@ kind: secret name: gpg_private_key --- kind: signature -hmac: a993b5d815323a831ad4b7f3264e7d6726774cdf4a041f4818af50f366101079 +hmac: b07d95d16c5f0170c2f5c16a7b73a73b5c3989b531bf4a79e8487166cc8bf77b ... diff --git a/.github/workflows/helm-ci.yml b/.github/workflows/helm-ci.yml index 3f96a06c79a1c..dfa8ca51ba258 100644 --- a/.github/workflows/helm-ci.yml +++ b/.github/workflows/helm-ci.yml @@ -45,7 +45,7 @@ jobs: fetch-depth: 0 - name: Set up Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v3 with: version: v3.8.2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 81bda247ef241..2ddff6e2481e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ #### Loki ##### Enhancements -* [7380](https://github.com/grafana/loki/pull/7380) **liguozhong**: metrics query: range vector support streaming agg when no overlap +* [7951](https://github.com/grafana/loki/pull/7951) **MichelHollands**: Add a count template function to line_format and label_format. +* [7380](https://github.com/grafana/loki/pull/7380) **liguozhong**: metrics query: range vector support streaming agg when no overlap. * [7684](https://github.com/grafana/loki/pull/7684) **kavirajk**: Add missing `embedded-cache` config under `cache_config` doc. * [6360](https://github.com/grafana/loki/pull/6099) **liguozhong**: Hide error message when ctx timeout occurs in s3.getObject * [7602](https://github.com/grafana/loki/pull/7602) **vmax**: Add decolorize filter to easily parse colored logs. @@ -14,13 +15,27 @@ * [7785](https://github.com/grafana/loki/pull/7785) **dannykopping**: Add query blocker for queries and rules. * [7804](https://github.com/grafana/loki/pull/7804) **sandeepsukhani**: Use grpc for communicating with compactor for query time filtering of data requested for deletion. * [7817](https://github.com/grafana/loki/pull/7817) **kavirajk**: fix(memcached): panic on send on closed channel. +* [7916](https://github.com/grafana/loki/pull/7916) **ssncferreira**: Add `doc-generator` tool to generate configuration flags documentation. +* [7964](https://github.com/grafana/loki/pull/7964) **slim-bean**: Add a `since` query parameter to allow querying based on relative time. +* [7989](https://github.com/grafana/loki/pull/7989) **liguozhong**: logql support `sort` and `sort_desc`. +* [7997](https://github.com/grafana/loki/pull/7997) **kavirajk**: fix(promtail): Fix cri tags extra new lines when joining partial lines +* [8027](https://github.com/grafana/loki/pull/8027) **kavirajk**: chore(promtail): Make `batchwait` and `batchsize` config explicit with yaml tags +* [7978](https://github.com/grafana/loki/pull/7978) **chaudum**: Shut down query frontend gracefully to allow inflight requests to complete. +* [8047](https://github.com/grafana/loki/pull/8047) **bboreham**: Dashboards: add k8s resource requests to CPU and memory panels. +* [8061](https://github.com/grafana/loki/pull/8061) **kavirajk**: Remove circle from Loki OSS ##### Fixes +* [7926](https://github.com/grafana/loki/pull/7926) **MichelHollands**: Fix validation for pattern and regexp parsers. * [7720](https://github.com/grafana/loki/pull/7720) **sandeepsukhani**: fix bugs in processing delete requests with line filters. * [7708](https://github.com/grafana/loki/pull/7708) **DylanGuedes**: Fix multitenant querying. * [7784](https://github.com/grafana/loki/pull/7784) **isodude**: Fix default values of connect addresses for compactor and querier workers to work with IPv6. * [7880](https://github.com/grafana/loki/pull/7880) **sandeepsukhani**: consider range and offset in queries while looking for schema config for query sharding. +* [7937](https://github.com/grafana/loki/pull/7937) **ssncferreira**: Deprecate CLI flag `-ruler.wal-cleaer.period` and replace it with `-ruler.wal-cleaner.period`. +* [7906](https://github.com/grafana/loki/pull/7906) **kavirajk**: Add API endpoint that formats LogQL expressions and support new `fmt` subcommand in `logcli` to format LogQL query. +* [7966](https://github.com/grafana/loki/pull/7966) **sandeepsukhani**: Fix query-frontend request load balancing when using k8s service. +* [7988](https://github.com/grafana/loki/pull/7988) **ashwanthgoli** store: write overlapping chunks to multiple stores. +* [7925](https://github.com/grafana/loki/pull/7925) **sandeepsukhani**: Fix bugs in logs results caching causing query-frontend to return logs outside of query window. ##### Changes @@ -46,8 +61,15 @@ #### Loki Canary +##### Enhancements +* [8024](https://github.com/grafana/loki/pull/8024) **jijotj**: Support passing loki address as environment variable + #### Jsonnet +#### Build + +* [7938](https://github.com/grafana/loki/pull/7938) **ssncferreira**: Add DroneCI pipeline step to validate configuration flags documentation generation. + ### Notes This release was created from a branch starting at commit FIXME but it may also contain backported changes from main. @@ -111,10 +133,10 @@ Check the history of the branch FIXME. * [6835](https://github.com/grafana/loki/pull/6835) **DylanGuedes**: Add new per-tenant query timeout configuration and remove engine query timeout. * [7212](https://github.com/grafana/loki/pull/7212) **Juneezee**: Replaces deprecated `io/ioutil` with `io` and `os`. * [7361](https://github.com/grafana/loki/pull/7361) **szczepad**: Renames metric `loki_log_messages_total` to `loki_internal_log_messages_total` +* [7416](https://github.com/grafana/loki/pull/7416) **mstrzele**: Use the stable `HorizontalPodAutoscaler` v2, if possible, when installing using Helm * [7510](https://github.com/grafana/loki/pull/7510) **slim-bean**: Limited queries (queries without filter expressions) will now be split and sharded. * [5400](https://github.com/grafana/loki/pull/5400) **BenoitKnecht**: promtail/server: Disable profiling by default - #### Promtail ##### Enhancements @@ -147,6 +169,7 @@ Check the history of the branch FIXME. #### Jsonnet * [6189](https://github.com/grafana/loki/pull/6189) **irizzant**: Add creation of a `ServiceMonitor` object for Prometheus scraping through configuration parameter `create_service_monitor`. Simplify mixin usage by adding (https://github.com/prometheus-operator/kube-prometheus) library. +* [6662](https://github.com/grafana/loki/pull/6662) **Whyeasy**: Fixes memberlist error when using a stateful ruler. ### Notes diff --git a/Makefile b/Makefile index 3343bf74c48dc..7570012ecd1a4 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ .PHONY: bigtable-backup, push-bigtable-backup .PHONY: benchmark-store, drone, check-drone-drift, check-mod .PHONY: migrate migrate-image lint-markdown ragel +.PHONY: doc check-doc .PHONY: validate-example-configs generate-example-config-doc check-example-config-doc .PHONY: clean clean-protos @@ -27,7 +28,7 @@ DOCKER_IMAGE_DIRS := $(patsubst %/Dockerfile,%,$(DOCKERFILES)) BUILD_IN_CONTAINER ?= true # ensure you run `make drone` after changing this -BUILD_IMAGE_VERSION := 0.25.0 +BUILD_IMAGE_VERSION := 0.26.0 # Docker image info IMAGE_PREFIX ?= grafana @@ -71,6 +72,13 @@ RAGEL_GOS := $(patsubst %.rl,%.rl.go,$(RAGEL_DEFS)) PROMTAIL_GENERATED_FILE := clients/pkg/promtail/server/ui/assets_vfsdata.go PROMTAIL_UI_FILES := $(shell find ./clients/pkg/promtail/server/ui -type f -name assets_vfsdata.go -prune -o -print) +# Documentation source path +DOC_SOURCES_PATH := docs/sources + +# Configuration flags documentation +DOC_FLAGS_TEMPLATE := $(DOC_SOURCES_PATH)/configuration/index.template +DOC_FLAGS := $(DOC_SOURCES_PATH)/configuration/_index.md + ########## # Docker # ########## @@ -719,6 +727,16 @@ format: find . $(DONT_FIND) -name '*.pb.go' -prune -o -name '*.y.go' -prune -o -name '*.rl.go' -prune -o \ -type f -name '*.go' -exec goimports -w -local github.com/grafana/loki {} \; +# Documentation related commands + +doc: ## Generates the config file documentation + go run ./tools/doc-generator $(DOC_FLAGS_TEMPLATE) > $(DOC_FLAGS) + +check-doc: ## Check the documentation files are up to date +check-doc: doc + @find . -name "*.md" | xargs git diff --exit-code -- \ + || (echo "Please update generated documentation by running 'make doc' and committing the changes" && false) + ################### # Example Configs # ################### diff --git a/README.md b/README.md index 19c466caf5de5..45af4ec8dc27b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@

Loki Logo

Drone CI -CircleCI Go Report Card Slack [![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/loki.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:loki) diff --git a/clients/pkg/logentry/stages/extensions.go b/clients/pkg/logentry/stages/extensions.go index 3957292237b04..08abf20cc2360 100644 --- a/clients/pkg/logentry/stages/extensions.go +++ b/clients/pkg/logentry/stages/extensions.go @@ -62,7 +62,7 @@ func (c *cri) Run(entry chan Entry) chan Entry { if len(c.partialLines) >= c.maxPartialLines { // Merge existing partialLines newPartialLine := e.Line - e.Line = strings.Join(c.partialLines, "\n") + e.Line = strings.Join(c.partialLines, "") level.Warn(c.base.logger).Log("msg", "cri stage: partial lines upperbound exceeded. merging it to single line", "threshold", MaxPartialLinesSize) c.partialLines = c.partialLines[:0] c.partialLines = append(c.partialLines, newPartialLine) @@ -73,7 +73,7 @@ func (c *cri) Run(entry chan Entry) chan Entry { } if len(c.partialLines) > 0 { c.partialLines = append(c.partialLines, e.Line) - e.Line = strings.Join(c.partialLines, "\n") + e.Line = strings.Join(c.partialLines, "") c.partialLines = c.partialLines[:0] } return e, false diff --git a/clients/pkg/logentry/stages/extensions_test.go b/clients/pkg/logentry/stages/extensions_test.go index 083d414e5d2a4..bb6bfe30de6ab 100644 --- a/clients/pkg/logentry/stages/extensions_test.go +++ b/clients/pkg/logentry/stages/extensions_test.go @@ -107,50 +107,33 @@ func TestCRI_tags(t *testing.T) { { name: "tag P", lines: []string{ - "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 1", - "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 2", + "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 1 ", + "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 2 ", "2019-05-07T18:57:55.904275087+00:00 stdout F log finished", "2019-05-07T18:57:55.904275087+00:00 stdout F another full log", }, expected: []string{ - "partial line 1\npartial line 2\nlog finished", + "partial line 1 partial line 2 log finished", "another full log", }, }, { name: "tag P exceeding MaxPartialLinesSize lines", lines: []string{ - "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 1", - "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 2", + "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 1 ", + "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 2 ", "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 3", - "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 4", // this exceeds the `MaxPartialLinesSize` of 3 + "2019-05-07T18:57:50.904275087+00:00 stdout P partial line 4 ", // this exceeds the `MaxPartialLinesSize` of 3 "2019-05-07T18:57:55.904275087+00:00 stdout F log finished", "2019-05-07T18:57:55.904275087+00:00 stdout F another full log", }, maxPartialLines: 3, expected: []string{ - "partial line 1\npartial line 2\npartial line 3", - "partial line 4\nlog finished", + "partial line 1 partial line 2 partial line 3", + "partial line 4 log finished", "another full log", }, }, - { - name: "panic", - lines: []string{ - "2019-05-07T18:57:50.904275087+00:00 stdout P panic: I'm pannicing", - "2019-05-07T18:57:50.904275087+00:00 stdout P ", - "2019-05-07T18:57:50.904275087+00:00 stdout P goroutine 1 [running]:", - "2019-05-07T18:57:55.904275087+00:00 stdout P main.main()", - "2019-05-07T18:57:55.904275087+00:00 stdout F /home/kavirajk/src/go-play/main.go:11 +0x27", - }, - expected: []string{ - `panic: I'm pannicing - -goroutine 1 [running]: -main.main() - /home/kavirajk/src/go-play/main.go:11 +0x27`, - }, - }, } for _, tt := range cases { diff --git a/clients/pkg/promtail/client/config.go b/clients/pkg/promtail/client/config.go index 7a81fdb4f1709..b080592c680ed 100644 --- a/clients/pkg/promtail/client/config.go +++ b/clients/pkg/promtail/client/config.go @@ -25,8 +25,8 @@ const ( type Config struct { Name string `yaml:"name,omitempty"` URL flagext.URLValue - BatchWait time.Duration - BatchSize int + BatchWait time.Duration `yaml:"batchwait"` + BatchSize int `yaml:"batchsize"` Client config.HTTPClientConfig `yaml:",inline"` diff --git a/clients/pkg/promtail/targets/file/tailer.go b/clients/pkg/promtail/targets/file/tailer.go index 79605ca1f92fb..c9297cd04d235 100644 --- a/clients/pkg/promtail/targets/file/tailer.go +++ b/clients/pkg/promtail/targets/file/tailer.go @@ -8,7 +8,7 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/hpcloud/tail" + "github.com/grafana/tail" "github.com/pkg/errors" "github.com/prometheus/common/model" "go.uber.org/atomic" diff --git a/clients/pkg/promtail/targets/heroku/target_test.go b/clients/pkg/promtail/targets/heroku/target_test.go index 81d10136a0f7f..70b8383890b9e 100644 --- a/clients/pkg/promtail/targets/heroku/target_test.go +++ b/clients/pkg/promtail/targets/heroku/target_test.go @@ -100,7 +100,7 @@ func TestHerokuDrainTarget(t *testing.T) { args: args{ RequestBodies: []string{testPayload}, RequestParams: map[string][]string{ - "some_query_param": []string{"app_123", "app_456"}, + "some_query_param": {"app_123", "app_456"}, }, Labels: model.LabelSet{ "job": "some_job_name", @@ -145,7 +145,7 @@ func TestHerokuDrainTarget(t *testing.T) { args: args{ RequestBodies: []string{testLogLine1, testLogLine2}, RequestParams: map[string][]string{ - "some_query_param": []string{"app_123", "app_456"}, + "some_query_param": {"app_123", "app_456"}, }, Labels: model.LabelSet{ "job": "multiple_line_job", @@ -215,7 +215,7 @@ func TestHerokuDrainTarget(t *testing.T) { args: args{ RequestBodies: []string{testLogLine1}, RequestParams: map[string][]string{ - "some_query_param": []string{"app_123", "app_456"}, + "some_query_param": {"app_123", "app_456"}, }, Labels: model.LabelSet{ "job": "relabeling_job", diff --git a/cmd/chunks-inspect/loki.go b/cmd/chunks-inspect/loki.go index 2ae2f9df8db22..35bb90774a2cb 100644 --- a/cmd/chunks-inspect/loki.go +++ b/cmd/chunks-inspect/loki.go @@ -43,7 +43,7 @@ var ( enclz4_1M = Encoding{code: 6, name: "lz4-1M", readerFn: func(reader io.Reader) (io.Reader, error) { return lz4.NewReader(reader), nil }} enclz4_4M = Encoding{code: 7, name: "lz4-4M", readerFn: func(reader io.Reader) (io.Reader, error) { return lz4.NewReader(reader), nil }} encFlate = Encoding{code: 8, name: "flate", readerFn: func(reader io.Reader) (io.Reader, error) { return flate.NewReader(reader), nil }} - encZstd = Encoding{code: 9, name: "lz4-256k", readerFn: func(reader io.Reader) (io.Reader, error) { + encZstd = Encoding{code: 9, name: "zstd", readerFn: func(reader io.Reader) (io.Reader, error) { r, err := zstd.NewReader(reader) if err != nil { panic(err) diff --git a/cmd/logcli/main.go b/cmd/logcli/main.go index f34aa808ca021..5c71e413bf464 100644 --- a/cmd/logcli/main.go +++ b/cmd/logcli/main.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "io" "log" "math" "net/url" @@ -18,6 +20,7 @@ import ( "github.com/grafana/loki/pkg/logcli/output" "github.com/grafana/loki/pkg/logcli/query" "github.com/grafana/loki/pkg/logcli/seriesquery" + "github.com/grafana/loki/pkg/logql/syntax" _ "github.com/grafana/loki/pkg/util/build" ) @@ -109,6 +112,8 @@ Use the --analyze-labels flag to get a summary of the labels found in all stream This is helpful to find high cardinality labels. `) seriesQuery = newSeriesQuery(seriesCmd) + + fmtCmd = app.Command("fmt", "Formats a LogQL query.") ) func main() { @@ -213,7 +218,27 @@ func main() { labelsQuery.DoLabels(queryClient) case seriesCmd.FullCommand(): seriesQuery.DoSeries(queryClient) + case fmtCmd.FullCommand(): + if err := formatLogQL(os.Stdin, os.Stdout); err != nil { + log.Fatalf("unable to format logql: %s", err) + } + } +} + +func formatLogQL(r io.Reader, w io.Writer) error { + b, err := io.ReadAll(r) + if err != nil { + return err } + + expr, err := syntax.ParseExpr(string(b)) + if err != nil { + return fmt.Errorf("failed to parse the query: %w", err) + } + + fmt.Fprintf(w, "%s\n", syntax.Prettify(expr)) + + return nil } func newQueryClient(app *kingpin.Application) client.Client { diff --git a/cmd/loki-canary/main.go b/cmd/loki-canary/main.go index a54a335be091e..2dbb43ecd497f 100644 --- a/cmd/loki-canary/main.go +++ b/cmd/loki-canary/main.go @@ -1,7 +1,6 @@ package main import ( - "flag" "fmt" "io" "os" @@ -19,6 +18,7 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/config" "github.com/prometheus/common/version" + "gopkg.in/alecthomas/kingpin.v2" "github.com/grafana/loki/pkg/canary/comparator" "github.com/grafana/loki/pkg/canary/reader" @@ -26,12 +26,6 @@ import ( _ "github.com/grafana/loki/pkg/util/build" ) -const ( - defaultMinBackoff = 500 * time.Millisecond - defaultMaxBackoff = 5 * time.Minute - defaultMaxRetries = 10 -) - type canary struct { lock sync.Mutex @@ -42,52 +36,52 @@ type canary struct { func main() { - lName := flag.String("labelname", "name", "The label name for this instance of loki-canary to use in the log selector") - lVal := flag.String("labelvalue", "loki-canary", "The unique label value for this instance of loki-canary to use in the log selector") - sName := flag.String("streamname", "stream", "The stream name for this instance of loki-canary to use in the log selector") - sValue := flag.String("streamvalue", "stdout", "The unique stream value for this instance of loki-canary to use in the log selector") - port := flag.Int("port", 3500, "Port which loki-canary should expose metrics") - addr := flag.String("addr", "", "The Loki server URL:Port, e.g. loki:3100") - push := flag.Bool("push", false, "Push the logs directly to given Loki address") - useTLS := flag.Bool("tls", false, "Does the loki connection use TLS?") - certFile := flag.String("cert-file", "", "Client PEM encoded X.509 certificate for optional use with TLS connection to Loki") - keyFile := flag.String("key-file", "", "Client PEM encoded X.509 key for optional use with TLS connection to Loki") - caFile := flag.String("ca-file", "", "Client certificate authority for optional use with TLS connection to Loki") - insecureSkipVerify := flag.Bool("insecure", false, "Allow insecure TLS connections") - user := flag.String("user", "", "Loki username.") - pass := flag.String("pass", "", "Loki password. This credential should have both read and write permissions to Loki endpoints") - tenantID := flag.String("tenant-id", "", "Tenant ID to be set in X-Scope-OrgID header.") - writeTimeout := flag.Duration("write-timeout", 10*time.Second, "How long to wait write response from Loki") - writeMinBackoff := flag.Duration("write-min-backoff", defaultMinBackoff, "Initial backoff time before first retry ") - writeMaxBackoff := flag.Duration("write-max-backoff", defaultMaxBackoff, "Maximum backoff time between retries ") - writeMaxRetries := flag.Int("write-max-retries", defaultMaxRetries, "Maximum number of retries when push a log entry ") - queryTimeout := flag.Duration("query-timeout", 10*time.Second, "How long to wait for a query response from Loki") - - interval := flag.Duration("interval", 1000*time.Millisecond, "Duration between log entries") - outOfOrderPercentage := flag.Int("out-of-order-percentage", 0, "Percentage (0-100) of log entries that should be sent out of order.") - outOfOrderMin := flag.Duration("out-of-order-min", 30*time.Second, "Minimum amount of time to go back for out of order entries (in seconds).") - outOfOrderMax := flag.Duration("out-of-order-max", 60*time.Second, "Maximum amount of time to go back for out of order entries (in seconds).") - - size := flag.Int("size", 100, "Size in bytes of each log line") - wait := flag.Duration("wait", 60*time.Second, "Duration to wait for log entries on websocket before querying loki for them") - maxWait := flag.Duration("max-wait", 5*time.Minute, "Duration to keep querying Loki for missing websocket entries before reporting them missing") - pruneInterval := flag.Duration("pruneinterval", 60*time.Second, "Frequency to check sent vs received logs, "+ - "also the frequency which queries for missing logs will be dispatched to loki") - buckets := flag.Int("buckets", 10, "Number of buckets in the response_latency histogram") - - metricTestInterval := flag.Duration("metric-test-interval", 1*time.Hour, "The interval the metric test query should be run") - metricTestQueryRange := flag.Duration("metric-test-range", 24*time.Hour, "The range value [24h] used in the metric test instant-query."+ - " Note: this value is truncated to the running time of the canary until this value is reached") - - spotCheckInterval := flag.Duration("spot-check-interval", 15*time.Minute, "Interval that a single result will be kept from sent entries and spot-checked against Loki, "+ - "e.g. 15min default one entry every 15 min will be saved and then queried again every 15min until spot-check-max is reached") - spotCheckMax := flag.Duration("spot-check-max", 4*time.Hour, "How far back to check a spot check entry before dropping it") - spotCheckQueryRate := flag.Duration("spot-check-query-rate", 1*time.Minute, "Interval that the canary will query Loki for the current list of all spot check entries") - spotCheckWait := flag.Duration("spot-check-initial-wait", 10*time.Second, "How long should the spot check query wait before starting to check for entries") - - printVersion := flag.Bool("version", false, "Print this builds version information") - - flag.Parse() + lName := kingpin.Flag("labelname", "The label name for this instance of loki-canary to use in the log selector").Default("name").String() + lVal := kingpin.Flag("labelvalue", "The unique label value for this instance of loki-canary to use in the log selector").Default("loki-canary").String() + sName := kingpin.Flag("streamname", "The stream name for this instance of loki-canary to use in the log selector").Default("stream").String() + sValue := kingpin.Flag("streamvalue", "The unique stream value for this instance of loki-canary to use in the log selector").Default("stdout").String() + port := kingpin.Flag("port", "Port which loki-canary should expose metrics").Default("3500").Int() + addr := kingpin.Flag("addr", "The Loki server URL:Port, e.g. loki:3100").Default("").Envar("LOKI_ADDRESS").String() + push := kingpin.Flag("push", "Push the logs directly to given Loki address").Default("false").Bool() + useTLS := kingpin.Flag("tls", "Does the loki connection use TLS?").Default("false").Bool() + certFile := kingpin.Flag("cert-file", "Client PEM encoded X.509 certificate for optional use with TLS connection to Loki").Default("").String() + keyFile := kingpin.Flag("key-file", "Client PEM encoded X.509 key for optional use with TLS connection to Loki").Default("").String() + caFile := kingpin.Flag("ca-file", "Client certificate authority for optional use with TLS connection to Loki").Default("").String() + insecureSkipVerify := kingpin.Flag("insecure", "Allow insecure TLS connections").Default("false").Bool() + user := kingpin.Flag("user", "Loki username.").Default("").Envar("LOKI_USERNAME").String() + pass := kingpin.Flag("pass", "Loki password. This credential should have both read and write permissions to Loki endpoints").Default("").Envar("LOKI_PASSWORD").String() + tenantID := kingpin.Flag("tenant-id", "Tenant ID to be set in X-Scope-OrgID header.").Default("").String() + writeTimeout := kingpin.Flag("write-timeout", "How long to wait write response from Loki").Default("10s").Duration() + writeMinBackoff := kingpin.Flag("write-min-backoff", "Initial backoff time before first retry ").Default("500ms").Duration() + writeMaxBackoff := kingpin.Flag("write-max-backoff", "Maximum backoff time between retries ").Default("5m").Duration() + writeMaxRetries := kingpin.Flag("write-max-retries", "Maximum number of retries when push a log entry ").Default("10").Int() + queryTimeout := kingpin.Flag("query-timeout", "How long to wait for a query response from Loki").Default("10s").Duration() + + interval := kingpin.Flag("interval", "Duration between log entries").Default("1s").Duration() + outOfOrderPercentage := kingpin.Flag("out-of-order-percentage", "Percentage (0-100) of log entries that should be sent out of order.").Default("0").Int() + outOfOrderMin := kingpin.Flag("out-of-order-min", "Minimum amount of time to go back for out of order entries (in seconds).").Default("30s").Duration() + outOfOrderMax := kingpin.Flag("out-of-order-max", "Maximum amount of time to go back for out of order entries (in seconds).").Default("60s").Duration() + + size := kingpin.Flag("size", "Size in bytes of each log line").Default("100").Int() + wait := kingpin.Flag("wait", "Duration to wait for log entries on websocket before querying loki for them").Default("60s").Duration() + maxWait := kingpin.Flag("max-wait", "Duration to keep querying Loki for missing websocket entries before reporting them missing").Default("5m").Duration() + pruneInterval := kingpin.Flag("pruneinterval", "Frequency to check sent vs received logs, "+ + "also the frequency which queries for missing logs will be dispatched to loki").Default("60s").Duration() + buckets := kingpin.Flag("buckets", "Number of buckets in the response_latency histogram").Default("10").Int() + + metricTestInterval := kingpin.Flag("metric-test-interval", "The interval the metric test query should be run").Default("1h").Duration() + metricTestQueryRange := kingpin.Flag("metric-test-range", "The range value [24h] used in the metric test instant-query."+ + " Note: this value is truncated to the running time of the canary until this value is reached").Default("24h").Duration() + + spotCheckInterval := kingpin.Flag("spot-check-interval", "Interval that a single result will be kept from sent entries and spot-checked against Loki, "+ + "e.g. 15min default one entry every 15 min will be saved and then queried again every 15min until spot-check-max is reached").Default("15m").Duration() + spotCheckMax := kingpin.Flag("spot-check-max", "How far back to check a spot check entry before dropping it").Default("4h").Duration() + spotCheckQueryRate := kingpin.Flag("spot-check-query-rate", "Interval that the canary will query Loki for the current list of all spot check entries").Default("1m").Duration() + spotCheckWait := kingpin.Flag("spot-check-initial-wait", "How long should the spot check query wait before starting to check for entries").Default("10s").Duration() + + printVersion := kingpin.Flag("version", "Print this builds version information").Default("false").Bool() + + kingpin.Parse() if *printVersion { fmt.Println(version.Print("loki-canary")) @@ -95,7 +89,7 @@ func main() { } if *addr == "" { - _, _ = fmt.Fprintf(os.Stderr, "Must specify a Loki address with -addr\n") + _, _ = fmt.Fprintf(os.Stderr, "Must specify a Loki address with -addr or set the environemnt variable LOKI_ADDRESS\n") os.Exit(1) } diff --git a/cmd/loki/main.go b/cmd/loki/main.go index 86c09ba3a7798..b1ead7dde6e84 100644 --- a/cmd/loki/main.go +++ b/cmd/loki/main.go @@ -21,6 +21,11 @@ import ( "github.com/grafana/loki/pkg/validation" ) +func exit(code int) { + util_log.Flush() + os.Exit(code) +} + func main() { var config loki.ConfigWrapper @@ -41,7 +46,7 @@ func main() { // Init the logger which will honor the log level set in config.Server if reflect.DeepEqual(&config.Server.LogLevel, &logging.Level{}) { level.Error(util_log.Logger).Log("msg", "invalid log level") - os.Exit(1) + exit(1) } util_log.InitLogger(&config.Server, prometheus.DefaultRegisterer, config.UseBufferedLogger, config.UseSyncLogger) @@ -49,7 +54,7 @@ func main() { // and CLI flags parsed. if err := config.Validate(); err != nil { level.Error(util_log.Logger).Log("msg", "validating config", "err", err.Error()) - os.Exit(1) + exit(1) } if config.PrintConfig { @@ -66,7 +71,7 @@ func main() { if config.VerifyConfig { level.Info(util_log.Logger).Log("msg", "config is valid") - os.Exit(0) + exit(0) } if config.Tracing.Enabled { @@ -97,7 +102,7 @@ func main() { if config.ListTargets { t.ListTargets() - os.Exit(0) + exit(0) } level.Info(util_log.Logger).Log("msg", "Starting Loki", "version", version.Info()) diff --git a/docs/sources/api/_index.md b/docs/sources/api/_index.md index 696ae7a4af9ab..413de4a334cbb 100644 --- a/docs/sources/api/_index.md +++ b/docs/sources/api/_index.md @@ -23,6 +23,7 @@ These endpoints are exposed by all components: - [`GET /config`](#list-current-configuration) - [`GET /services`](#list-running-services) - [`GET /loki/api/v1/status/buildinfo`](#list-build-information) +- [`GET /loki/api/v1/format_query`](#format-query) These endpoints are exposed by the querier and the query frontend: @@ -220,7 +221,7 @@ gave this response: } ``` -If your cluster has +If your cluster has [Grafana Loki Multi-Tenancy](../operations/multi-tenancy/) enabled, set the `X-Scope-OrgID` header to identify the tenant you want to query. Here is the same example query for the single tenant called `Tenant1`: @@ -268,6 +269,7 @@ accepts the following query parameters in the URL: - `limit`: The max number of entries to return. It defaults to `100`. Only applies to query types which produce a stream(log lines) response. - `start`: The start time for the query as a nanosecond Unix epoch or another [supported format](#timestamp-formats). Defaults to one hour ago. - `end`: The end time for the query as a nanosecond Unix epoch or another [supported format](#timestamp-formats). Defaults to now. +- `since`: A `duration` used to calculate `start` relative to `end`. If `end` is in the future, `start` is calculated as this duration before now. Any value specified for `start` supersedes this parameter. - `step`: Query resolution step width in `duration` format or float number of seconds. `duration` refers to Prometheus duration strings of the form `[0-9]+[smhdwy]`. For example, 5m refers to a duration of 5 minutes. Defaults to a dynamic value based on `start` and `end`. Only applies to query types which produce a matrix response. - `interval`: This parameter is experimental; see the explanation under Step versus interval. Only return entries at (or greater than) the specified interval, can be a `duration` format or float number of seconds. Only applies to queries which produce a stream response. - `direction`: Determines the sort order of logs. Supported values are `forward` or `backward`. Defaults to `backward.` @@ -438,6 +440,7 @@ It accepts the following query parameters in the URL: - `start`: The start time for the query as a nanosecond Unix epoch. Defaults to 6 hours ago. - `end`: The end time for the query as a nanosecond Unix epoch. Defaults to now. +- `since`: A `duration` used to calculate `start` relative to `end`. If `end` is in the future, `start` is calculated as this duration before now. Any value specified for `start` supersedes this parameter. In microservices mode, `/loki/api/v1/labels` is exposed by the querier. @@ -479,6 +482,7 @@ It accepts the following query parameters in the URL: - `start`: The start time for the query as a nanosecond Unix epoch. Defaults to 6 hours ago. - `end`: The end time for the query as a nanosecond Unix epoch. Defaults to now. +- `since`: A `duration` used to calculate `start` relative to `end`. If `end` is in the future, `start` is calculated as this duration before now. Any value specified for `start` supersedes this parameter. In microservices mode, `/loki/api/v1/label//values` is exposed by the querier. @@ -637,7 +641,7 @@ It accepts three URL query parameters `flush`, `delete_ring_tokens`, and `termin * `flush=`: Flag to control whether to flush any in-memory chunks the ingester holds. Defaults to `true`. * `delete_ring_tokens=`: - Flag to control whether to delete the file that contains the ingester ring tokens of the instance if the `-ingester.token-file-path` is specified. + Flag to control whether to delete the file that contains the ingester ring tokens of the instance if the `-ingester.token-file-path` is specified. Defaults to `false. * `terminate=`: Flag to control whether to terminate the Loki process after service shutdown. Defaults to `true`. @@ -703,6 +707,18 @@ GET /loki/api/v1/status/buildinfo `/loki/api/v1/status/buildinfo` exposes the build information in a JSON object. The fields are `version`, `revision`, `branch`, `buildDate`, `buildUser`, and `goVersion`. +## Format query + +``` +GET /loki/api/v1/format_query +POST /loki/api/v1/format_query +``` + +Params: +- `query`: A LogQL query string. Can be passed as URL param (`?query=`) in case of both `GET` and `POST`. Or as form value in case of `POST`. + +The `/loki/api/v1/format_query` endpoint allows to format LogQL queries. It returns an error if the passed LogQL is invalid. It is exposed by all Loki components and helps to improve readability and the debugging experience of LogQL queries. + ## List series The Series API is available under the following: @@ -718,6 +734,7 @@ URL query parameters: - `match[]=`: Repeated log stream selector argument that selects the streams to return. At least one `match[]` argument must be provided. - `start=`: Start timestamp. - `end=`: End timestamp. +- `since`: A `duration` used to calculate `start` relative to `end`. If `end` is in the future, `start` is calculated as this duration before now. Any value specified for `start` supersedes this parameter. You can URL-encode these parameters directly in the request body by using the POST method and `Content-Type: application/x-www-form-urlencoded` header. This is useful when specifying a large or dynamic number of stream selectors that may breach server-side URL character limits. @@ -1204,6 +1221,7 @@ support the following values: - `limit`: The max number of entries to return - `start`: The start time for the query as a nanosecond Unix epoch. Defaults to one hour ago. - `end`: The end time for the query as a nanosecond Unix epoch. Defaults to now. +- `since`: A `duration` used to calculate `start` relative to `end`. If `end` is in the future, `start` is calculated as this duration before now. Any value specified for `start` supersedes this parameter. - `direction`: Determines the sort order of logs. Supported values are `forward` or `backward`. Defaults to `backward.` - `regexp`: a regex to filter the returned results @@ -1271,6 +1289,7 @@ the URL: - `start`: The start time for the query as a nanosecond Unix epoch. Defaults to 6 hours ago. - `end`: The end time for the query as a nanosecond Unix epoch. Defaults to now. +- `since`: A `duration` used to calculate `start` relative to `end`. If `end` is in the future, `start` is calculated as this duration before now. Any value specified for `start` supersedes this parameter. In microservices mode, `/api/prom/label//values` is exposed by the querier. @@ -1307,6 +1326,7 @@ accepts the following query parameters in the URL: - `start`: The start time for the query as a nanosecond Unix epoch. Defaults to 6 hours ago. - `end`: The end time for the query as a nanosecond Unix epoch. Defaults to now. +- `since`: A `duration` used to calculate `start` relative to `end`. If `end` is in the future, `start` is calculated as this duration before now. Any value specified for `start` supersedes this parameter. In microservices mode, `/api/prom/label` is exposed by the querier. @@ -1385,4 +1405,3 @@ This is helpful for scaling down WAL-enabled ingesters where we want to ensure o but instead flushed to our chunk backend. In microservices mode, the `/ingester/flush_shutdown` endpoint is exposed by the ingester. - diff --git a/docs/sources/clients/promtail/configuration.md b/docs/sources/clients/promtail/configuration.md index 6aea0c66879c8..43a1e923de2fe 100644 --- a/docs/sources/clients/promtail/configuration.md +++ b/docs/sources/clients/promtail/configuration.md @@ -65,7 +65,7 @@ Where default_value is the value to use if the environment variable is undefined slashes with single slashes. Because of this every use of a slash `\` needs to be replaced with a double slash `\\` -### Generic placeholders: +### Generic placeholders - ``: a boolean that can take the values `true` or `false` - ``: any integer matching the regular expression `[1-9]+[0-9]*` @@ -1965,7 +1965,7 @@ sync_period: "10s" The `tracing` block configures tracing for Jaeger. Currently, limited to configuration per [environment variables](https://www.jaegertracing.io/docs/1.16/client-features/) only. ```yaml -# When true, +# When true, [enabled: | default = false] ``` diff --git a/docs/sources/clients/promtail/installation.md b/docs/sources/clients/promtail/installation.md index 693d5296ea9c1..a19d72456fd4f 100644 --- a/docs/sources/clients/promtail/installation.md +++ b/docs/sources/clients/promtail/installation.md @@ -37,7 +37,7 @@ helm repo update Finally, Promtail can be deployed with: ```bash -$ helm upgrade --install promtail grafana/promtail --set "loki.serviceName=loki" +helm upgrade --install promtail grafana/promtail ``` ## Kubernetes diff --git a/docs/sources/clients/promtail/scraping.md b/docs/sources/clients/promtail/scraping.md index 41b1ca6a117c5..8405459838513 100644 --- a/docs/sources/clients/promtail/scraping.md +++ b/docs/sources/clients/promtail/scraping.md @@ -53,9 +53,9 @@ There are different types of labels present in Promtail: - The `__path__` label is a special label which Promtail uses after discovery to figure out where the file to read is located. Wildcards are allowed, for example `/var/log/*.log` to get all files with a `log` extension in the specified directory, and `/var/log/**/*.log` for matching files and directories recursively. For a full list of options check out the docs for the [library](https://github.com/bmatcuk/doublestar) Promtail uses. -- The `__path_exclude__` label is another special label Promtail uses after - discovery, to exclude a subset of the files discovered using `__path__` from - being read in the current scrape_config block. It uses the same +- The `__path_exclude__` label is another special label Promtail uses after + discovery, to exclude a subset of the files discovered using `__path__` from + being read in the current scrape_config block. It uses the same [library](https://github.com/bmatcuk/doublestar) to enable usage of wildcards and glob patterns. @@ -65,7 +65,7 @@ There are different types of labels present in Promtail: ### Kubernetes Discovery -Note that while Promtail can utilize the Kubernetes API to discover pods as +While Promtail can use the Kubernetes API to discover pods as targets, it can only read log files from pods that are running on the same node as the one Promtail is running on. Promtail looks for a `__host__` label on each target and validates that it is set to the same hostname as Promtail's @@ -82,7 +82,7 @@ relabel_configs: target_label: '__host__' ``` -See [Relabeling](#relabeling) for more information. For more information on how to configure the service discovery see the [Kubernetes Service Discovery configuration](../configuration/#kubernetes_sd_config). +See [Relabeling](#relabeling) for more information. For more information on how to configure the service discovery see the [Kubernetes Service Discovery configuration]({{< relref "configuration#kubernetes_sd_config" >}}). ## Journal Scraping (Linux Only) @@ -191,7 +191,7 @@ You can relabel default labels via [Relabeling](#relabeling) if required. Providing a path to a bookmark is mandatory, it will be used to persist the last event processed and allow resuming the target without skipping logs. -see the [configuration](https://grafana.com/docs/loki/latest/clients/promtail/configuration/#windows_events) section for more information. +Read the [configuration]({{< relref "configuration#windows_events" >}}) section for more information. ## GCP Log scraping @@ -254,7 +254,7 @@ When Promtail receives GCP logs, various internal labels are made available for When configuring the GCP Log push target, Promtail will start an HTTP server listening on port `8080`, as configured in the `server` section. This server exposes the single endpoint `POST /gcp/api/v1/push`, responsible for receiving logs from GCP. -For Google's PubSub to be able to send logs, **Promtail server must be publicly accessible, and support HTTPS**. For that, Promtail can be deployed +For Google's PubSub to be able to send logs, **Promtail server must be publicly accessible, and support HTTPS**. For that, Promtail can be deployed as part of a larger orchestration service like Kubernetes, which can handle HTTPS traffic through an ingress, or it can be hosted behind a proxy/gateway, offloading the HTTPS to that component and routing the request to Promtail. Once that's solved, GCP can be [configured](../gcplog-cloud) to send logs to Promtail. @@ -269,7 +269,7 @@ When Promtail receives GCP logs, various internal labels are made available for - `__gcp_resource_type` - `__gcp_resource_labels_` -In the example above, the `__gcp_message_id` and the `__gcp_attributes_logging_googleapis_com_timestamp` labels are +In the example above, the `__gcp_message_id` and the `__gcp_attributes_logging_googleapis_com_timestamp` labels are transformed to `message_id` and `incoming_ts` through `relabel_configs`. All other internal labels, for example some other attribute, will be dropped by the target if not transformed. @@ -377,8 +377,8 @@ scrape_configs: target_label: message_key ``` -Only the `brokers` and `topics` is required. -see the [configuration](../../configuration/#kafka) section for more information. +Only the `brokers` and `topics` are required. +Read the [configuration]({{< relref "configuration#kafka" >}}) section for more information. ## GELF @@ -427,7 +427,7 @@ scrape_configs: ``` Only `api_token` and `zone_id` are required. -Refer to the [Cloudfare](configuration/#cloudflare) configuration section for details. +Refer to the [Cloudfare]({{< relref "configuration#cloudflare" >}}) configuration section for details. ## Heroku Drain Promtail supports receiving logs from a Heroku application by using a [Heroku HTTPS Drain](https://devcenter.heroku.com/articles/log-drains#https-drains). @@ -454,11 +454,11 @@ Configuration is specified in a`heroku_drain` block within the Promtail `scrape_ ``` Within the `scrape_configs` configuration for a Heroku Drain target, the `job_name` must be a Prometheus-compatible [metric name](https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels). -The [server](../configuration.md#server) section configures the HTTP server created for receiving logs. +The [server]({{< relref "configuration#server" >}}) section configures the HTTP server created for receiving logs. `labels` defines a static set of label values added to each received log entry. `use_incoming_timestamp` can be used to pass the timestamp received from Heroku. -Before using a `heroku_drain` target, Heroku should be configured with the URL where the Promtail instance will be listening. +Before using a `heroku_drain` target, Heroku should be configured with the URL where the Promtail instance will be listening. Follow the steps in [Heroku HTTPS Drain docs](https://devcenter.heroku.com/articles/log-drains#https-drains) for using the Heroku CLI with a command like the following: @@ -558,5 +558,5 @@ clients: - [ ] ``` -Refer to [`client_config`](./configuration#client_config) from the Promtail +Refer to [`client_config`]({{< relref "configuration#client_config" >}}) from the Promtail Configuration reference for all available options. diff --git a/docs/sources/clients/promtail/stages/tenant.md b/docs/sources/clients/promtail/stages/tenant.md index 80a1004acb30d..e6dfb6b354198 100644 --- a/docs/sources/clients/promtail/stages/tenant.md +++ b/docs/sources/clients/promtail/stages/tenant.md @@ -91,16 +91,16 @@ The pipeline would: ```yaml scrape_configs: - job_name: kubernetes-pods-name - + kubernetes_sd_configs: - role: pod - + relabel_configs: - action: replace source_labels: - __meta_kubernetes_namespace target_label: namespace - + pipeline_stages: - match: selector: '{namespace=".+"}' diff --git a/docs/sources/configuration/_index.md b/docs/sources/configuration/_index.md index 43e052a13416d..b4324572facc9 100644 --- a/docs/sources/configuration/_index.md +++ b/docs/sources/configuration/_index.md @@ -1,8 +1,13 @@ --- -title: Configuration +description: Describes parameters used to configure Grafana Loki. +menuTitle: Configuration parameters +title: Grafana Loki configuration parameters weight: 500 --- -# Configuring Grafana Loki + +# Grafana Loki configuration parameters + + Grafana Loki is configured in a YAML file (usually referred to as `loki.yaml` ) which contains information on the Loki server and its individual components, @@ -10,10 +15,10 @@ depending on which mode Loki is launched in. Configuration examples can be found in the [Configuration Examples](examples/) document. -## Printing Loki Config At Runtime +## Printing Loki config at runtime If you pass Loki the flag `-print-config-stderr` or `-log-config-reverse-order`, (or `-print-config-stderr=true`) -Loki will dump the entire config object it has created from the built in defaults combined first with +Loki will dump the entire config object it has created from the built-in defaults combined first with overrides from config file, and second by overrides from flags. The result is the value for every config object in the Loki config struct, which is very large... @@ -29,20 +34,20 @@ is especially useful in making sure your config files and flags are being read a `-log-config-reverse-order` is the flag we run Loki with in all our environments, the config entries are reversed so that the order of configs reads correctly top to bottom when viewed in Grafana's Explore. -## Reload At Runtime +## Reload at runtime Promtail can reload its configuration at runtime. If the new configuration is not well-formed, the changes will not be applied. A configuration reload is triggered by sending a `SIGHUP` to the Promtail process or sending a HTTP POST request to the `/reload` endpoint (when the `--server.enable-runtime-reload` flag is enabled). -## Configuration File Reference +## Configuration file reference To specify which configuration file to load, pass the `-config.file` flag at the command line. The value can be a list of comma separated paths, then the first file that exists will be used. If no `-config.file` argument is specified, Loki will look up the `config.yaml` in the -current working directory and the `config/` sub-directory and try to use that. +current working directory and the `config/` subdirectory and try to use that. The file is written in [YAML format](https://en.wikipedia.org/wiki/YAML), defined by the scheme below. @@ -91,27 +96,29 @@ Pass the `-config.expand-env` flag at the command line to enable this way of set ### Supported contents and default values of `loki.yaml` ```yaml -# A comma-separated list of components to run. -# The default value "all" runs Loki in single binary mode. -# The value "read" is an alias to run only read-path related components such as -# the querier and query-frontend, but all in the same process. -# The value "write" is an alias to run only write-path related components such as -# the distributor and compactor, but all in the same process. -# Supported values: all, compactor, distributor, ingester, querier, query-scheduler, -# ingester-querier, query-frontend, index-gateway, ruler, table-manager, read, write. -# A full list of available targets can be printed when running Loki with the -# `-list-targets` command line flag. +# A comma-separated list of components to run. The default value 'all' runs Loki +# in single binary mode. The value 'read' is an alias to run only read-path +# related components such as the querier and query-frontend, but all in the same +# process. The value 'write' is an alias to run only write-path related +# components such as the distributor and compactor, but all in the same process. +# Supported values: all, compactor, distributor, ingester, querier, +# query-scheduler, ingester-querier, query-frontend, index-gateway, ruler, +# table-manager, read, write. A full list of available targets can be printed +# when running Loki with the '-list-targets' command line flag. +# CLI flag: -target [target: | default = "all"] # Enables authentication through the X-Scope-OrgID header, which must be present -# if true. If false, the OrgID will always be set to "fake". +# if true. If false, the OrgID will always be set to 'fake'. +# CLI flag: -auth.enabled [auth_enabled: | default = true] -# The amount of virtual memory in bytes to reserve as ballast in order to optimize -# garbage collection. Larger ballasts result in fewer garbage collection passes, reducing -# CPU overhead at the cost of heap size. The ballast will not consume physical memory, -# because it is never read from. It will, however, distort metrics, because it is -# counted as live memory. +# The amount of virtual memory in bytes to reserve as ballast in order to +# optimize garbage collection. Larger ballasts result in fewer garbage +# collection passes, reducing CPU overhead at the cost of heap size. The ballast +# will not consume physical memory, because it is never read from. It will, +# however, distort metrics, because it is counted as live memory. +# CLI flag: -config.ballast-bytes [ballast_bytes: | default = 0] # Configures the server of the launched module(s). @@ -120,12 +127,12 @@ Pass the `-config.expand-env` flag at the command line to enable this way of set # Configures the distributor. [distributor: ] -# Configures the querier. Only appropriate when running all modules or -# just the querier. +# Configures the querier. Only appropriate when running all modules or just the +# querier. [querier: ] -# The query_scheduler block configures the Loki query scheduler. -# When configured it separates the tenant query queues from the query-frontend +# The query_scheduler block configures the Loki query scheduler. When configured +# it separates the tenant query queues from the query-frontend. [query_scheduler: ] # The frontend block configures the Loki query-frontend. @@ -138,122 +145,144 @@ Pass the `-config.expand-env` flag at the command line to enable this way of set # The ruler block configures the Loki ruler. [ruler: ] -# The ingester_client block configures how the distributor will connect -# to ingesters. Only appropriate when running all components, the distributor, -# or the querier. +# The ingester_client block configures how the distributor will connect to +# ingesters. Only appropriate when running all components, the distributor, or +# the querier. [ingester_client: ] -# The ingester block configures the ingester and how the ingester will register itself -# to a key value store. +# The ingester block configures the ingester and how the ingester will register +# itself to a key value store. [ingester: ] -# Configures the index gateway server. +# The index_gateway block configures the Loki index gateway server, responsible +# for serving index queries without the need to constantly interact with the +# object store. [index_gateway: ] -# Configures where Loki will store data. +# The storage_config block configures one of many possible stores for both the +# index and chunks. Which configuration to be picked should be defined in +# schema_config block. [storage_config: ] -# Configures how Loki will store data in the specific store. +# The chunk_store_config block configures how chunks will be cached and how long +# to wait before saving them to the backing store. [chunk_store_config: ] # Configures the chunk index schema and where it is stored. [schema_config: ] -# The compactor block configures the compactor component, which compacts index shards -# for performance. +# The compactor block configures the compactor component, which compacts index +# shards for performance. [compactor: ] -# Configures limits per-tenant or globally. +# The limits_config block configures global and per-tenant limits in Loki. [limits_config: ] -# The frontend_worker configures the worker - running within the Loki -# querier - picking up and executing queries enqueued by the query-frontend. +# The frontend_worker configures the worker - running within the Loki querier - +# picking up and executing queries enqueued by the query-frontend. [frontend_worker: ] # The table_manager block configures the table manager for retention. [table_manager: ] -# Configuration for "runtime config" module, responsible for reloading runtime +# Configuration for 'runtime config' module, responsible for reloading runtime # configuration file. [runtime_config: ] # Configuration for tracing. [tracing: ] -# Common configuration to be shared between multiple modules. -# If a more specific configuration is given in other sections, -# the related configuration within this section will be ignored. -[common: ] - -# Configuration for usage report +# Configuration for usage report. [analytics: ] + +# Common configuration to be shared between multiple modules. If a more specific +# configuration is given in other sections, the related configuration within +# this section will be ignored. +[common: ] ``` -## server +### server -The `server` block -configures the HTTP and gRPC server communication of the launched service(s). +Configures the `server` of the launched module(s). ```yaml -# HTTP server listen host +# HTTP server listen network, default tcp +# CLI flag: -server.http-listen-network +[http_listen_network: | default = "tcp"] + +# HTTP server listen address. # CLI flag: -server.http-listen-address -[http_listen_address: ] +[http_listen_address: | default = ""] -# HTTP server listen port +# HTTP server listen port. # CLI flag: -server.http-listen-port -[http_listen_port: | default = 80] +[http_listen_port: | default = 3100] + +# Maximum number of simultaneous http connections, <=0 to disable +# CLI flag: -server.http-conn-limit +[http_listen_conn_limit: | default = 0] + +# gRPC server listen network +# CLI flag: -server.grpc-listen-network +[grpc_listen_network: | default = "tcp"] + +# gRPC server listen address. +# CLI flag: -server.grpc-listen-address +[grpc_listen_address: | default = ""] + +# gRPC server listen port. +# CLI flag: -server.grpc-listen-port +[grpc_listen_port: | default = 9095] + +# Maximum number of simultaneous grpc connections, <=0 to disable +# CLI flag: -server.grpc-conn-limit +[grpc_listen_conn_limit: | default = 0] + +# Comma-separated list of cipher suites to use. If blank, the default Go cipher +# suites is used. +# CLI flag: -server.tls-cipher-suites +[tls_cipher_suites: | default = ""] + +# Minimum TLS version to use. Allowed values: VersionTLS10, VersionTLS11, +# VersionTLS12, VersionTLS13. If blank, the Go TLS minimum version is used. +# CLI flag: -server.tls-min-version +[tls_min_version: | default = ""] -# TLS configuration for serving over HTTPS http_tls_config: # HTTP server cert path. # CLI flag: -server.http-tls-cert-path [cert_file: | default = ""] + # HTTP server key path. # CLI flag: -server.http-tls-key-path [key_file: | default = ""] + # HTTP TLS Client Auth type. # CLI flag: -server.http-tls-client-auth [client_auth_type: | default = ""] + # HTTP TLS Client CA path. # CLI flag: -server.http-tls-ca-path [client_ca_file: | default = ""] - # HTTP TLS Cipher Suites. - # CLI flag: -server.http-tls-cipher-suites - [tls_cipher_suites: | default = ""] - # HTTP TLS Min Version. - # CLI flag: -server.http-tls-min-version - [tls_min_version: | default = ""] - -# gRPC server listen host -# CLI flag: -server.grpc-listen-address -[grpc_listen_address: ] -# gRPC server listen port -# CLI flag: -server.grpc-listen-port -[grpc_listen_port: | default = 9095] - -# TLS configuration for serving over gRPC grpc_tls_config: - # gRPC server cert path. + # GRPC TLS server cert path. # CLI flag: -server.grpc-tls-cert-path [cert_file: | default = ""] - # gRPC server key path. + + # GRPC TLS server key path. # CLI flag: -server.grpc-tls-key-path [key_file: | default = ""] - # gRPC TLS Client Auth type. + + # GRPC TLS Client Auth type. # CLI flag: -server.grpc-tls-client-auth [client_auth_type: | default = ""] - # gRPC TLS Client CA path. + + # GRPC TLS Client CA path. # CLI flag: -server.grpc-tls-ca-path [client_ca_file: | default = ""] - # GRPC TLS Cipher Suites. - # CLI flag: -server.grpc-tls-cipher-suites - [tls_cipher_suites: | default = ""] - # GRPC TLS Min Version. - # CLI flag: -server.grpc-tls-min-version - [tls_min_version: | default = ""] -# Register instrumentation handlers (/metrics, etc.) +# Register the intrumentation handlers (/metrics etc). # CLI flag: -server.register-instrumentation [register_instrumentation: | default = true] @@ -271,13 +300,13 @@ grpc_tls_config: # Idle timeout for HTTP server # CLI flag: -server.http-idle-timeout -[http_server_idle_timeout: | default = 120s] +[http_server_idle_timeout: | default = 2m] -# Max gRPC message size that can be received +# Limit on the size of a gRPC message this server can receive (bytes). # CLI flag: -server.grpc-max-recv-msg-size-bytes [grpc_server_max_recv_msg_size: | default = 4194304] -# Max gRPC message size that can be sent +# Limit on the size of a gRPC message this server can send (bytes). # CLI flag: -server.grpc-max-send-msg-size-bytes [grpc_server_max_send_msg_size: | default = 4194304] @@ -285,71 +314,153 @@ grpc_tls_config: # CLI flag: -server.grpc-max-concurrent-streams [grpc_server_max_concurrent_streams: | default = 100] -# Log only messages with the given severity or above. Supported values [debug, +# The duration after which an idle connection should be closed. Default: +# infinity +# CLI flag: -server.grpc.keepalive.max-connection-idle +[grpc_server_max_connection_idle: | default = 2562047h47m16.854775807s] + +# The duration for the maximum amount of time a connection may exist before it +# will be closed. Default: infinity +# CLI flag: -server.grpc.keepalive.max-connection-age +[grpc_server_max_connection_age: | default = 2562047h47m16.854775807s] + +# An additive period after max-connection-age after which the connection will be +# forcibly closed. Default: infinity +# CLI flag: -server.grpc.keepalive.max-connection-age-grace +[grpc_server_max_connection_age_grace: | default = 2562047h47m16.854775807s] + +# Duration after which a keepalive probe is sent in case of no activity over the +# connection., Default: 2h +# CLI flag: -server.grpc.keepalive.time +[grpc_server_keepalive_time: | default = 2h] + +# After having pinged for keepalive check, the duration after which an idle +# connection should be closed, Default: 20s +# CLI flag: -server.grpc.keepalive.timeout +[grpc_server_keepalive_timeout: | default = 20s] + +# Minimum amount of time a client should wait before sending a keepalive ping. +# If client sends keepalive ping more often, server will send GOAWAY and close +# the connection. +# CLI flag: -server.grpc.keepalive.min-time-between-pings +[grpc_server_min_time_between_pings: | default = 10s] + +# If true, server allows keepalive pings even when there are no active +# streams(RPCs). If false, and client sends ping when there are no active +# streams, server will send GOAWAY and close the connection. +# CLI flag: -server.grpc.keepalive.ping-without-stream-allowed +[grpc_server_ping_without_stream_allowed: | default = true] + +# Output log messages in the given format. Valid formats: [logfmt, json] +# CLI flag: -log.format +[log_format: | default = "logfmt"] + +# Only log messages with the given severity or above. Valid levels: [debug, # info, warn, error] # CLI flag: -log.level [log_level: | default = "info"] -# Base path to serve all API routes from (e.g., /v1/). +# Optionally log the source IPs. +# CLI flag: -server.log-source-ips-enabled +[log_source_ips_enabled: | default = false] + +# Header field storing the source IPs. Only used if +# server.log-source-ips-enabled is true. If not set the default Forwarded, +# X-Real-IP and X-Forwarded-For headers are used +# CLI flag: -server.log-source-ips-header +[log_source_ips_header: | default = ""] + +# Regex for matching the source IPs. Only used if server.log-source-ips-enabled +# is true. If not set the default Forwarded, X-Real-IP and X-Forwarded-For +# headers are used +# CLI flag: -server.log-source-ips-regex +[log_source_ips_regex: | default = ""] + +# Optionally log requests at info level instead of debug level. +# CLI flag: -server.log-request-at-info-level-enabled +[log_request_at_info_level_enabled: | default = false] + +# Base path to serve all API routes from (e.g. /v1/) # CLI flag: -server.path-prefix [http_path_prefix: | default = ""] ``` -## distributor +### distributor -The `distributor` block configures the distributor component. +Configures the `distributor`. ```yaml -# Configures the distributors ring, used when the "global" ingestion rate -# strategy is enabled. ring: kvstore: - # The backend storage to use for the ring. Supported values are - # consul, etcd, inmemory, memberlist + # Backend storage to use for the ring. Supported values are: consul, etcd, + # inmemory, memberlist, multi. # CLI flag: -distributor.ring.store - store: + [store: | default = "consul"] # The prefix for the keys in the store. Should end with a /. # CLI flag: -distributor.ring.prefix [prefix: | default = "collectors/"] - # Configuration for a Consul client. Only applies if store is "consul" - # The CLI flags prefix for this block config is: distributor.ring - [consul: ] + # Configuration for a Consul client. Only applies if store is consul. + # The CLI flags prefix for this block configuration is: distributor.ring + [consul: ] - # Configuration for an ETCD v3 client. Only applies if store is "etcd" - # The CLI flags prefix for this block config is: distributor.ring - [etcd: ] + # Configuration for an ETCD v3 client. Only applies if store is etcd. + # The CLI flags prefix for this block configuration is: distributor.ring + [etcd: ] - # The heartbeat timeout after which ingesters are skipped for - # reading and writing. - # CLI flag: -distributor.ring.heartbeat-timeout - [heartbeat_timeout: | default = 1m] + multi: + # Primary backend storage used by multi-client. + # CLI flag: -distributor.ring.multi.primary + [primary: | default = ""] + + # Secondary backend storage used by multi-client. + # CLI flag: -distributor.ring.multi.secondary + [secondary: | default = ""] + + # Mirror writes to secondary store. + # CLI flag: -distributor.ring.multi.mirror-enabled + [mirror_enabled: | default = false] - rate_store: - # The max number of concurrent requests to make to ingester stream apis - # CLI flag: -distributor.rate-store.max-request-parallelism - [max_request_parallelism: | default = 200] - # The interval on which distributors will update current stream rates - # from ingesters - # CLI flag: -distributor.rate-store.stream-rate-update-interval - [stream_rate_update_interval: | default = 1s] - # Timeout for communication between distributors and ingesters when updating - # rates - # CLI flag: -distributor.rate-store.ingester-request-timeout - [ingester_request_timeout: | default = 1s] + # Timeout for storing value to secondary store. + # CLI flag: -distributor.ring.multi.mirror-timeout + [mirror_timeout: | default = 2s] + + # Period at which to heartbeat to the ring. 0 = disabled. + # CLI flag: -distributor.ring.heartbeat-period + [heartbeat_period: | default = 5s] + + # The heartbeat timeout after which distributors are considered unhealthy + # within the ring. 0 = never (timeout disabled). + # CLI flag: -distributor.ring.heartbeat-timeout + [heartbeat_timeout: | default = 1m] + + # Name of network interface to read address from. + # CLI flag: -distributor.ring.instance-interface-names + [instance_interface_names: | default = []] + +rate_store: + # The max number of concurrent requests to make to ingester stream apis + # CLI flag: -distributor.rate-store.max-request-parallelism + [max_request_parallelism: | default = 200] + + # The interval on which distributors will update current stream rates from + # ingesters + # CLI flag: -distributor.rate-store.stream-rate-update-interval + [stream_rate_update_interval: | default = 1s] + + # Timeout for communication between distributors and any given ingester when + # updating rates + # CLI flag: -distributor.rate-store.ingester-request-timeout + [ingester_request_timeout: | default = 500ms] ``` -## querier +### querier -The `querier` block configures the Loki Querier. +Configures the `querier`. Only appropriate when running all modules or just the querier. ```yaml -# Timeout when querying ingesters or storage during the execution of a query request. -# CLI flag: -querier.query-timeout -[query_timeout: | default = 1m] - -# Maximum duration for which the live tailing requests should be served. +# Maximum duration for which the live tailing requests are served. # CLI flag: -querier.tail-max-duration [tail_max_duration: | default = 1h] @@ -357,46 +468,43 @@ The `querier` block configures the Loki Querier. # CLI flag: -querier.extra-query-delay [extra_query_delay: | default = 0s] -# Maximum lookback beyond which queries are not sent to ingester. -# 0 means all queries are sent to ingester. +# Maximum lookback beyond which queries are not sent to ingester. 0 means all +# queries are sent to ingester. # CLI flag: -querier.query-ingesters-within [query_ingesters_within: | default = 3h] +engine: + # Deprecated: Use querier.query-timeout instead. Timeout for query execution. + # CLI flag: -querier.engine.timeout + [timeout: | default = 5m] + + # The maximum amount of time to look back for log lines. Used only for instant + # log queries. + # CLI flag: -querier.engine.max-lookback-period + [max_look_back_period: | default = 30s] + # The maximum number of concurrent queries allowed. # CLI flag: -querier.max-concurrent [max_concurrent: | default = 10] -# Only query the store, and not attempt any ingesters. -# This is useful for running a standalone querier pool operating only against -# stored data. +# Only query the store, and not attempt any ingesters. This is useful for +# running a standalone querier pool operating only against stored data. # CLI flag: -querier.query-store-only [query_store_only: | default = false] -# When true, queriers only query the ingesters, and not stored data. -# This is useful when the object store is unavailable. +# When true, queriers only query the ingesters, and not stored data. This is +# useful when the object store is unavailable. # CLI flag: -querier.query-ingester-only [query_ingester_only: | default = false] # When true, allow queries to span multiple tenants. # CLI flag: -querier.multi-tenant-queries-enabled [multi_tenant_queries_enabled: | default = false] - -# Configuration options for the LogQL engine. -engine: - # Timeout for query execution. - # Deprecated: use querier.query-timeout instead. - # CLI flag: -querier.engine.timeout - [timeout: | default = 3m] - - # The maximum amount of time to look back for log lines. Only - # applicable for instant log queries. - # CLI flag: -querier.engine.max-lookback-period - [max_look_back_period: | default = 30s] ``` -## query_scheduler +### query_scheduler -The `query_scheduler` block configures the Loki query scheduler. +The `query_scheduler` block configures the Loki query scheduler. When configured it separates the tenant query queues from the query-frontend. ```yaml # Maximum number of outstanding requests per tenant per query-scheduler. @@ -406,123 +514,208 @@ The `query_scheduler` block configures the Loki query scheduler. [max_outstanding_requests_per_tenant: | default = 100] # If a querier disconnects without sending notification about graceful shutdown, -# the query-scheduler will keep the querier in the tenant's shard until the forget delay has passed. -# This feature is useful to reduce the blast radius when shuffle-sharding is enabled. +# the query-scheduler will keep the querier in the tenant's shard until the +# forget delay has passed. This feature is useful to reduce the blast radius +# when shuffle-sharding is enabled. # CLI flag: -query-scheduler.querier-forget-delay -[querier_forget_delay: | default = 0] +[querier_forget_delay: | default = 0s] # This configures the gRPC client used to report errors back to the # query-frontend. -[grpc_client_config: ] - -# Set to true to have the query schedulers create and place themselves in a ring. -# If no frontend_address or scheduler_address are present -# anywhere else in the configuration, Loki will toggle this value to true. +# The CLI flags prefix for this block configuration is: +# query-scheduler.grpc-client-config +[grpc_client_config: ] + +# Set to true to have the query schedulers create and place themselves in a +# ring. If no frontend_address or scheduler_address are present anywhere else in +# the configuration, Loki will toggle this value to true. +# CLI flag: -query-scheduler.use-scheduler-ring [use_scheduler_ring: | default = false] -# The hash ring configuration. This option is required only if use_scheduler_ring is true -# The CLI flags prefix for this block config is scheduler.ring -[scheduler_ring: ] -``` +# The hash ring configuration. This option is required only if +# use_scheduler_ring is true. +scheduler_ring: + kvstore: + # Backend storage to use for the ring. Supported values are: consul, etcd, + # inmemory, memberlist, multi. + # CLI flag: -query-scheduler.ring.store + [store: | default = "consul"] -## frontend + # The prefix for the keys in the store. Should end with a /. + # CLI flag: -query-scheduler.ring.prefix + [prefix: | default = "collectors/"] -The `frontend` block configures the Loki query-frontend. + # Configuration for a Consul client. Only applies if store is consul. + # The CLI flags prefix for this block configuration is: query-scheduler.ring + [consul: ] -```yaml -# Maximum number of outstanding requests per tenant per frontend; requests -# beyond this error with HTTP 429. -# CLI flag: -querier.max-outstanding-requests-per-tenant -[max_outstanding_per_tenant: | default = 2048] + # Configuration for an ETCD v3 client. Only applies if store is etcd. + # The CLI flags prefix for this block configuration is: query-scheduler.ring + [etcd: ] -# In the event a tenant is repeatedly sending queries that lead the querier to crash -# or be killed due to an out-of-memory error, the crashed querier will be disconnected -# from the query frontend and a new querier will be immediately assigned to the tenant’s shard. -# This invalidates the assumption that shuffle sharding can be used to reduce the -# impact on tenants. This option mitigates the impact by configuring a delay between when -# a querier disconnects because of a crash and when the crashed querier is actually removed -# from the tenant's shard. -# CLI flag: -query-frontend.querier-forget-delay -[querier_forget_delay: | default = 0s] + multi: + # Primary backend storage used by multi-client. + # CLI flag: -query-scheduler.ring.multi.primary + [primary: | default = ""] -# Compress HTTP responses. -# CLI flag: -querier.compress-http-responses -[compress_responses: | default = false] + # Secondary backend storage used by multi-client. + # CLI flag: -query-scheduler.ring.multi.secondary + [secondary: | default = ""] -# URL of downstream Loki. -# CLI flag: -frontend.downstream-url -[downstream_url: | default = ""] + # Mirror writes to secondary store. + # CLI flag: -query-scheduler.ring.multi.mirror-enabled + [mirror_enabled: | default = false] -# Log queries that are slower than the specified duration. Set to 0 to disable. -# Set to < 0 to enable on all queries. -# CLI flag: -frontend.log-queries-longer-than -[log_queries_longer_than: | default = 0s] + # Timeout for storing value to secondary store. + # CLI flag: -query-scheduler.ring.multi.mirror-timeout + [mirror_timeout: | default = 2s] -# URL of querier for tail proxy. -# CLI flag: -frontend.tail-proxy-url -[tail_proxy_url: | default = ""] + # Period at which to heartbeat to the ring. 0 = disabled. + # CLI flag: -query-scheduler.ring.heartbeat-period + [heartbeat_period: | default = 15s] -tail_tls_config: - # Path to the client certificate file, which will be used for authenticating - # with the server. Also requires the key path to be configured. - # CLI flag: -frontend.tail-tls-config.tls-cert-path - [tls_cert_path: | default = ""] + # The heartbeat timeout after which compactors are considered unhealthy within + # the ring. 0 = never (timeout disabled). + # CLI flag: -query-scheduler.ring.heartbeat-timeout + [heartbeat_timeout: | default = 1m] - # Path to the key file for the client certificate. Also requires the client - # certificate to be configured. - # CLI flag: -frontend.tail-tls-config.tls-key-path - [tls_key_path: | default = ""] + # File path where tokens are stored. If empty, tokens are not stored at + # shutdown and restored at startup. + # CLI flag: -query-scheduler.ring.tokens-file-path + [tokens_file_path: | default = ""] - # Path to the CA certificates file to validate server certificate against. If - # not set, the host's root CA certificates are used. - # CLI flag: -frontend.tail-tls-config.tls-ca-path - [tls_ca_path: | default = ""] + # True to enable zone-awareness and replicate blocks across different + # availability zones. + # CLI flag: -query-scheduler.ring.zone-awareness-enabled + [zone_awareness_enabled: | default = false] - # Skip validating server certificate. - # CLI flag: -frontend.tail-tls-config.tls-insecure-skip-verify - [tls_insecure_skip_verify: | default = false] + # Instance ID to register in the ring. + # CLI flag: -query-scheduler.ring.instance-id + [instance_id: | default = ""] - # Override the default cipher suite list (separated by commas). - # CLI flag: -frontend.tail-tls-config.tls_cipher_suites - [tls_cipher_suites: | default = ""] + # Name of network interface to read address from. + # CLI flag: -query-scheduler.ring.instance-interface-names + [instance_interface_names: | default = []] - # Override the default minimum TLS version. - # CLI flag: -frontend.tail-tls-config.tls_min_version - [tls_min_version: | default = ""] + # Port to advertise in the ring (defaults to server.grpc-listen-port). + # CLI flag: -query-scheduler.ring.instance-port + [instance_port: | default = 0] + + # IP address to advertise in the ring. + # CLI flag: -query-scheduler.ring.instance-addr + [instance_addr: | default = ""] + # The availability zone where this instance is running. Required if + # zone-awareness is enabled. + # CLI flag: -query-scheduler.ring.instance-availability-zone + [instance_availability_zone: | default = ""] +``` + +### frontend + +The `frontend` block configures the Loki query-frontend. + +```yaml +# Log queries that are slower than the specified duration. Set to 0 to disable. +# Set to < 0 to enable on all queries. +# CLI flag: -frontend.log-queries-longer-than +[log_queries_longer_than: | default = 0s] + +# Max body size for downstream prometheus. +# CLI flag: -frontend.max-body-size +[max_body_size: | default = 10485760] + +# True to enable query statistics tracking. When enabled, a message with some +# statistics is logged for every query. +# CLI flag: -frontend.query-stats-enabled +[query_stats_enabled: | default = false] + +# Maximum number of outstanding requests per tenant per frontend; requests +# beyond this error with HTTP 429. +# CLI flag: -querier.max-outstanding-requests-per-tenant +[max_outstanding_per_tenant: | default = 2048] + +# In the event a tenant is repeatedly sending queries that lead the querier to +# crash or be killed due to an out-of-memory error, the crashed querier will be +# disconnected from the query frontend and a new querier will be immediately +# assigned to the tenant’s shard. This invalidates the assumption that shuffle +# sharding can be used to reduce the impact on tenants. This option mitigates +# the impact by configuring a delay between when a querier disconnects because +# of a crash and when the crashed querier is actually removed from the tenant's +# shard. +# CLI flag: -query-frontend.querier-forget-delay +[querier_forget_delay: | default = 0s] # DNS hostname used for finding query-schedulers. # CLI flag: -frontend.scheduler-address [scheduler_address: | default = ""] # How often to resolve the scheduler-address, in order to look for new -# query-scheduler instances. -# Also used to determine how often to poll the scheduler-ring for addresses if configured. +# query-scheduler instances. Also used to determine how often to poll the +# scheduler-ring for addresses if the scheduler-ring is configured. # CLI flag: -frontend.scheduler-dns-lookup-period [scheduler_dns_lookup_period: | default = 10s] # Number of concurrent workers forwarding queries to single query-scheduler. # CLI flag: -frontend.scheduler-worker-concurrency [scheduler_worker_concurrency: | default = 5] + +# The grpc_client block configures the gRPC client used to communicate between +# two Loki components. +# The CLI flags prefix for this block configuration is: +# frontend.grpc-client-config +[grpc_client_config: ] + +# Time to wait for inflight requests to finish before forcefully shutting down. +# This needs to be aligned with the query timeout and the graceful termination +# period of the process orchestrator. +# CLI flag: -frontend.graceful-shutdown-timeout +[graceful_shutdown_timeout: | default = 5m] + +# Name of network interface to read address from. This address is sent to +# query-scheduler and querier, which uses it to send the query response back to +# query-frontend. +# CLI flag: -frontend.instance-interface-names +[instance_interface_names: | default = []] + +# Compress HTTP responses. +# CLI flag: -querier.compress-http-responses +[compress_responses: | default = false] + +# URL of downstream Loki. +# CLI flag: -frontend.downstream-url +[downstream_url: | default = ""] + +# URL of querier for tail proxy. +# CLI flag: -frontend.tail-proxy-url +[tail_proxy_url: | default = ""] + +# The TLS configuration. +[tail_tls_config: ] ``` -## query_range +### query_range -The `query_range` block configures query splitting and caching in the Loki query-frontend. +The `query_range` block configures the query splitting and caching in the Loki query-frontend. ```yaml -# Deprecated: Split queries by day and execute in parallel. -# Use -querier.split-queries-by-interval instead. -# CLI flag: -querier.split-queries-by-day -[split_queries_by_day: | default = false] +# Deprecated: Use -querier.split-queries-by-interval instead. CLI flag: +# -querier.split-queries-by-day. Split queries by day and execute in parallel. +[split_queries_by_interval: ] # Mutate incoming queries to align their start and end with their step. # CLI flag: -querier.align-querier-with-step [align_queries_with_step: | default = false] results_cache: - # The CLI flags prefix for this block config is: frontend - cache: + # The cache block configures the cache backend. + # The CLI flags prefix for this block configuration is: frontend + [cache: ] + + # Use compression in results cache. Supported values are: 'snappy' and '' + # (disable compression). + # CLI flag: -frontend.compression + [compression: | default = ""] # Cache query results. # CLI flag: -querier.cache-results @@ -537,48 +730,28 @@ results_cache: # query ASTs. This feature is supported only by the chunks storage engine. # CLI flag: -querier.parallelise-shardable-queries [parallelise_shardable_queries: | default = true] + +# List of headers forwarded by the query Frontend to downstream querier. +# CLI flag: -frontend.forward-headers-list +[forward_headers_list: | default = []] ``` -## ruler +### ruler The `ruler` block configures the Loki ruler. ```yaml # URL of alerts return path. # CLI flag: -ruler.external.url -[external_url: | default = ] - -# Labels to add to all alerts -external_labels: - [: ...] - -ruler_client: - # Path to the client certificate file, which will be used for authenticating - # with the server. Also requires the key path to be configured. - # CLI flag: -ruler.client.tls-cert-path - [tls_cert_path: | default = ""] - - # Path to the key file for the client certificate. Also requires the client - # certificate to be configured. - # CLI flag: -ruler.client.tls-key-path - [tls_key_path: | default = ""] +[external_url: ] - # Path to the CA certificates file to validate server certificate against. If - # not set, the host's root CA certificates are used. - # CLI flag: -ruler.client.tls-ca-path - [tls_ca_path: | default = ""] - - # Skip validating server certificate. - # CLI flag: -ruler.client.tls-insecure-skip-verify - [tls_insecure_skip_verify: | default = false] - - # Override the default cipher suite list (separated by commas). - # CLI flag: -ruler.client.tls_cipher_suites - [tls_cipher_suites: | default = ""] +# Labels to add to all alerts. +[external_labels: ] - # Override the default minimum TLS version. - # CLI flag: -ruler.client.tls_min_version - [tls_min_version: | default = ""] +# The grpc_client block configures the gRPC client used to communicate between +# two Loki components. +# The CLI flags prefix for this block configuration is: ruler.client +[ruler_client: ] # How frequently to evaluate rules. # CLI flag: -ruler.evaluation-interval @@ -588,96 +761,48 @@ ruler_client: # CLI flag: -ruler.poll-interval [poll_interval: | default = 1m] +# Deprecated: Use -ruler-storage. CLI flags and their respective YAML config +# options instead. storage: - # Method to use for backend rule storage (azure, gcs, s3, swift, local, bos). + # Method to use for backend rule storage (configdb, azure, gcs, s3, swift, + # local, bos) # CLI flag: -ruler.storage.type - [type: ] + [type: | default = ""] # Configures backend rule storage for Azure. + # The CLI flags prefix for this block configuration is: ruler.storage [azure: ] # Configures backend rule storage for GCS. + # The CLI flags prefix for this block configuration is: ruler.storage [gcs: ] # Configures backend rule storage for S3. + # The CLI flags prefix for this block configuration is: ruler [s3: ] + # Configures backend rule storage for Baidu Object Storage (BOS). + # The CLI flags prefix for this block configuration is: ruler.storage + [bos: ] + # Configures backend rule storage for Swift. + # The CLI flags prefix for this block configuration is: ruler.storage [swift: ] # Configures backend rule storage for a local file system directory. [local: ] - # Configures backend rule storage for Baidu Object Storage (BOS). - [bos: ] - - # The `hedging` block configures how to hedge storage requests. - [hedging: ] - -# Remote-write configuration to send rule samples to a Prometheus remote-write endpoint. -remote_write: - # Enable remote-write functionality. - # CLI flag: -ruler.remote-write.enabled - [enabled: | default = false] - # Minimum period to wait between refreshing remote-write reconfigurations. - # This should be greater than or equivalent to -limits.per-user-override-period. - [config_refresh_period: | default = 10s] - - # Deprecated: Use `clients` instead - # Configure remote write client. - [client: ] - - # Configure remote write clients. - # A map with remote client id as key. - clients: - [: ] - -wal: - # The directory in which to write tenant WAL files. Each tenant will have its own - # directory one level below this directory. - [dir: | default = "ruler-wal"] - # Frequency with which to run the WAL truncation process. - [truncate_frequency: | default = 60m] - # Minimum and maximum time series should exist in the WAL for. - [min_age: | default = 5m] - [max_age: | default = 4h] - -wal_cleaner: - # The minimum age of a WAL to consider for cleaning. - [min_age: | default = 12h] - # How often to run the WAL cleaner. - [period: | default = 0s (disabled)] - # File path to store temporary rule files. # CLI flag: -ruler.rule-path -[rule_path: | default = "/rules"] +[rule_path: | default = "/rules"] -# Comma-separated list of Alertmanager URLs to send notifications to. -# Each Alertmanager URL is treated as a separate group in the configuration. -# Multiple Alertmanagers in HA per group can be supported by using DNS -# resolution via -ruler.alertmanager-discovery. +# Comma-separated list of Alertmanager URLs to send notifications to. Each +# Alertmanager URL is treated as a separate group in the configuration. Multiple +# Alertmanagers in HA per group can be supported by using DNS resolution via +# '-ruler.alertmanager-discovery'. # CLI flag: -ruler.alertmanager-url [alertmanager_url: | default = ""] - -alertmanager_client: - # Sets the `Authorization` header on every remote write request with the - # configured username and password. - # password and password_file are mutually exclusive. - [basic_auth_username: ] - [basic_auth_password: ] - - # Optional `Authorization` header configuration. - authorization: - # Sets the authentication type. - [type: | default: Bearer] - # Sets the credentials. It is mutually exclusive with - # `credentials_file`. - [credentials: ] - # Sets the credentials to the credentials read from the configured file. - # It is mutually exclusive with `credentials`. - [credentials_file: ] - # Use DNS SRV records to discover Alertmanager hosts. # CLI flag: -ruler.alertmanager-discovery [enable_alertmanager_discovery: | default = false] @@ -686,13 +811,12 @@ alertmanager_client: # CLI flag: -ruler.alertmanager-refresh-interval [alertmanager_refresh_interval: | default = 1m] -# If enabled, then requests to Alertmanager use the v2 API. +# If enabled requests to Alertmanager will utilize the V2 API. # CLI flag: -ruler.alertmanager-use-v2 [enable_alertmanager_v2: | default = false] -# List of alert relabel configs -alert_relabel_configs: - [- ...] +# List of alert relabel configs. +[alert_relabel_configs: ] # Capacity of the queue for notifications to be sent to the Alertmanager. # CLI flag: -ruler.notification-queue-capacity @@ -702,6 +826,91 @@ alert_relabel_configs: # CLI flag: -ruler.notification-timeout [notification_timeout: | default = 10s] +alertmanager_client: + # Path to the client certificate file, which will be used for authenticating + # with the server. Also requires the key path to be configured. + # CLI flag: -ruler.alertmanager-client.tls-cert-path + [tls_cert_path: | default = ""] + + # Path to the key file for the client certificate. Also requires the client + # certificate to be configured. + # CLI flag: -ruler.alertmanager-client.tls-key-path + [tls_key_path: | default = ""] + + # Path to the CA certificates file to validate server certificate against. If + # not set, the host's root CA certificates are used. + # CLI flag: -ruler.alertmanager-client.tls-ca-path + [tls_ca_path: | default = ""] + + # Override the expected name on the server certificate. + # CLI flag: -ruler.alertmanager-client.tls-server-name + [tls_server_name: | default = ""] + + # Skip validating server certificate. + # CLI flag: -ruler.alertmanager-client.tls-insecure-skip-verify + [tls_insecure_skip_verify: | default = false] + + # Override the default cipher suite list (separated by commas). Allowed + # values: + # + # Secure Ciphers: + # - TLS_RSA_WITH_AES_128_CBC_SHA + # - TLS_RSA_WITH_AES_256_CBC_SHA + # - TLS_RSA_WITH_AES_128_GCM_SHA256 + # - TLS_RSA_WITH_AES_256_GCM_SHA384 + # - TLS_AES_128_GCM_SHA256 + # - TLS_AES_256_GCM_SHA384 + # - TLS_CHACHA20_POLY1305_SHA256 + # - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA + # - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA + # - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA + # - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + # - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 + # - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + # - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + # - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + # - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 + # - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 + # + # Insecure Ciphers: + # - TLS_RSA_WITH_RC4_128_SHA + # - TLS_RSA_WITH_3DES_EDE_CBC_SHA + # - TLS_RSA_WITH_AES_128_CBC_SHA256 + # - TLS_ECDHE_ECDSA_WITH_RC4_128_SHA + # - TLS_ECDHE_RSA_WITH_RC4_128_SHA + # - TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA + # - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 + # - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 + # CLI flag: -ruler.alertmanager-client.tls-cipher-suites + [tls_cipher_suites: | default = ""] + + # Override the default minimum TLS version. Allowed values: VersionTLS10, + # VersionTLS11, VersionTLS12, VersionTLS13 + # CLI flag: -ruler.alertmanager-client.tls-min-version + [tls_min_version: | default = ""] + + # HTTP Basic authentication username. It overrides the username set in the URL + # (if any). + # CLI flag: -ruler.alertmanager-client.basic-auth-username + [basic_auth_username: | default = ""] + + # HTTP Basic authentication password. It overrides the password set in the URL + # (if any). + # CLI flag: -ruler.alertmanager-client.basic-auth-password + [basic_auth_password: | default = ""] + + # HTTP Header authorization type (default: Bearer). + # CLI flag: -ruler.alertmanager-client.type + [type: | default = "Bearer"] + + # HTTP Header authorization credentials. + # CLI flag: -ruler.alertmanager-client.credentials + [credentials: | default = ""] + + # HTTP Header authorization credentials file. + # CLI flag: -ruler.alertmanager-client.credentials-file + [credentials_file: | default = ""] + # Max time to tolerate outage for restoring "for" state of alert. # CLI flag: -ruler.for-outage-tolerance [for_outage_tolerance: | default = 1h] @@ -719,395 +928,167 @@ alert_relabel_configs: # CLI flag: -ruler.enable-sharding [enable_sharding: | default = false] +# The sharding strategy to use. Supported values are: default, shuffle-sharding. +# CLI flag: -ruler.sharding-strategy +[sharding_strategy: | default = "default"] + # Time to spend searching for a pending ruler when shutting down. # CLI flag: -ruler.search-pending-for [search_pending_for: | default = 5m] -# Ring used by Loki ruler. -# The CLI flags prefix for this block config is ruler.ring +# Ring used by Loki ruler. The CLI flags prefix for this block configuration is +# 'ruler.ring'. ring: kvstore: # Backend storage to use for the ring. Supported values are: consul, etcd, # inmemory, memberlist, multi. - # CLI flag: -.store - [store: | default = "memberlist"] + # CLI flag: -ruler.ring.store + [store: | default = "consul"] # The prefix for the keys in the store. Should end with a /. - # CLI flag: -.prefix - [prefix: | default = "collectors/"] + # CLI flag: -ruler.ring.prefix + [prefix: | default = "rulers/"] - # The consul_config configures the consul client. - [consul: ] + # Configuration for a Consul client. Only applies if store is consul. + # The CLI flags prefix for this block configuration is: ruler.ring + [consul: ] - # The etcd_config configures the etcd client. - [etcd: ] + # Configuration for an ETCD v3 client. Only applies if store is etcd. + # The CLI flags prefix for this block configuration is: ruler.ring + [etcd: ] multi: # Primary backend storage used by multi-client. - # CLI flag: -.multi.primary + # CLI flag: -ruler.ring.multi.primary [primary: | default = ""] # Secondary backend storage used by multi-client. - # CLI flag: -.multi.secondary + # CLI flag: -ruler.ring.multi.secondary [secondary: | default = ""] # Mirror writes to secondary store. - # CLI flag: -.multi.mirror-enabled + # CLI flag: -ruler.ring.multi.mirror-enabled [mirror_enabled: | default = false] # Timeout for storing value to secondary store. - # CLI flag: -.multi.mirror-timeout + # CLI flag: -ruler.ring.multi.mirror-timeout [mirror_timeout: | default = 2s] # Interval between heartbeats sent to the ring. 0 = disabled. - # CLI flag: -.heartbeat-period - [heartbeat_period: | default = 15s] + # CLI flag: -ruler.ring.heartbeat-period + [heartbeat_period: | default = 5s] - # The heartbeat timeout after which ruler ring members are considered unhealthy - # within the ring. 0 = never (timeout disabled). - # CLI flag: -.heartbeat-timeout + # The heartbeat timeout after which ruler ring members are considered + # unhealthy within the ring. 0 = never (timeout disabled). + # CLI flag: -ruler.ring.heartbeat-timeout [heartbeat_timeout: | default = 1m] # Name of network interface to read addresses from. - # CLI flag: -.instance-interface-names - [instance_interface_names: | default = []] + # CLI flag: -ruler.ring.instance-interface-names + [instance_interface_names: | default = []] # The number of tokens the lifecycler will generate and put into the ring if # it joined without transferring tokens from another lifecycler. - # CLI flag: -.num-tokens + # CLI flag: -ruler.ring.num-tokens [num_tokens: | default = 128] -``` -## bos_storage_config +# Period with which to attempt to flush rule groups. +# CLI flag: -ruler.flush-period +[flush_period: | default = 1m] -The `bos_storage_config` block configures Baidu Object Storage (BOS) as general storage for data generated by Loki. +# Enable the ruler API. +# CLI flag: -ruler.enable-api +[enable_api: | default = true] -```yaml -# Name of BOS bucket. -# CLI flag: .baidubce.bucket-name -[ bucket_name: | default = "" ] -# BOS endpoint to connect to. -# CLI flag: .baidubce.endpoint -[ endpoint: | default = "bj.bcebos.com" ] -# Baidu Cloud Engine (BCE) Access Key ID -# CLI flag: .baidubce.access-key-id -[ access_key_id: | default = "" ] -# BCE Secret Access Key -# CLI flag: .baidubce.secret-access-key -[ secret_access_key: | default = "" ] -``` +# Comma separated list of tenants whose rules this ruler can evaluate. If +# specified, only these tenants will be handled by ruler, otherwise this ruler +# can process rules from all tenants. Subject to sharding. +# CLI flag: -ruler.enabled-tenants +[enabled_tenants: | default = ""] -## azure_storage_config +# Comma separated list of tenants whose rules this ruler cannot evaluate. If +# specified, a ruler that would normally pick the specified tenant(s) for +# processing will ignore them instead. Subject to sharding. +# CLI flag: -ruler.disabled-tenants +[disabled_tenants: | default = ""] -The `azure_storage_config` configures Azure as a general storage for different data generated by Loki. +# Report the wall time for ruler queries to complete as a per user metric and as +# an info level log message. +# CLI flag: -ruler.query-stats-enabled +[query_stats_enabled: | default = false] -```yaml -# Azure Cloud environment. Supported values are: AzureGlobal, -# AzureChinaCloud, AzureGermanCloud, AzureUSGovernment. -# CLI flag: -.azure.environment -[environment: | default = "AzureGlobal"] +# Disable the rule_group label on exported metrics. +# CLI flag: -ruler.disable-rule-group-label +[disable_rule_group_label: | default = false] -# Azure storage account name. -# CLI flag: -.azure.account-name -[account_name: | default = ""] - -# Azure storage account key. -# CLI flag: -.azure.account-key -[account_key: | default = ""] - -# Name of the storage account blob container used to store chunks. -# This container must be created before running Loki. -# CLI flag: -.azure.container-name -[container_name: | default = "loki"] - -# Azure storage endpoint suffix without schema. The storage account name will -# be prefixed to this value to create the FQDN. -# CLI flag: -.azure.endpoint-suffix -[endpoint_suffix: | default = ""] - -# Use Managed Identity to authenticate to the Azure storage account. -# CLI flag: -.azure.use-managed-identity -[use_managed_identity: | default = false] - -# User assigned identity ID to authenticate to the Azure storage account. -# CLI flag: -.azure.user-assigned-id -[user_assigned_id: | default = ""] - -# Chunk delimiter to build the blobID -# CLI flag: -.azure.chunk-delimiter -[chunk_delimiter: | default = "-"] - -# Preallocated buffer size for downloads. -# CLI flag: -.azure.download-buffer-size -[download_buffer_size: | default = 512000] - -# Preallocated buffer size for uploads. -# CLI flag: -.azure.upload-buffer-size -[upload_buffer_size: | default = 256000] - -# Number of buffers used to used to upload a chunk. -# CLI flag: -.azure.download-buffer-count -[upload_buffer_count: | default = 1] - -# Timeout for requests made against azure blob storage. -# CLI flag: -.azure.request-timeout -[request_timeout: | default = 30s] - -# Number of retries for a request which times out. -# CLI flag: -.azure.max-retries -[max_retries: | default = 5] - -# Minimum time to wait before retrying a request. -# CLI flag: -.azure.min-retry-delay -[min_retry_delay: | default = 10ms] - -# Maximum time to wait before retrying a request. -# CLI flag: -.azure.max-retry-delay -[max_retry_delay: | default = 500ms] -``` - -## gcs_storage_config - -The `gcs_storage_config` configures GCS as a general storage for different data generated by Loki. - -```yaml -# Name of GCS bucket to put chunks in. -# CLI flag: -.gcs.bucketname -[bucket_name: | default = ""] - -# Service account key content in JSON format. -# CLI flag: -.gcs.service-account -[service_account: | default = ""] - -# The size of the buffer that GCS client for each PUT request. 0 to disable -# buffering. -# CLI flag: -.gcs.chunk-buffer-size -[chunk_buffer_size: | default = 0] - -# The duration after which the requests to GCS should be timed out. -# CLI flag: -.gcs.request-timeout -[request_timeout: | default = 0s] - -# Enable HTTP/2 when connecting to GCS. This configuration only applies to GET operations. -# CLI flag: -.gcs.enable-http2 -[enable_http2: | default = true] -``` - -## s3_storage_config - -The `s3_storage_config` configures S3 as a general storage for different data generated by Loki. - -```yaml -# S3 endpoint URL with escaped Key and Secret encoded. If only region is -# specified as a host, proper endpoint will be deduced. Use -# inmemory:/// to use a mock in-memory implementation. -# CLI flag: -.s3.url -[s3: | default = ] - -# Set this to `true` to force the request to use path-style addressing. -# CLI flag: -.s3.force-path-style -[s3forcepathstyle: | default = false] - -# Comma separated list of bucket names to evenly distribute chunks over. -# Overrides any buckets specified in s3.url flag -# CLI flag: -.s3.buckets -[bucketnames: | default = ""] - -# S3 Endpoint to connect to. -# CLI flag: -.s3.endpoint -[endpoint: | default = ""] - -# AWS region to use. -# CLI flag: -.s3.region -[region: | default = ""] - -# AWS Access Key ID -# CLI flag: -.s3.access-key-id -[access_key_id: | default = ""] - -# AWS Secret Access Key -# CLI flag: -.s3.secret-access-key -[secret_access_key: | default = ""] - -# Disable https on S3 connection. -# CLI flag: -.s3.insecure -[insecure: | default = false] - -# Enable AES256 AWS server-side encryption -# CLI flag: -.s3.sse-encryption -[sse_encryption: | default = false] - -http_config: - # The maximum amount of time an idle connection will be held open. - # CLI flag: -.s3.http.idle-conn-timeout - [idle_conn_timeout: | default = 1m30s] - - # If non-zero, specifies the amount of time to wait for a server's - # response headers after fully writing the request. - # CLI flag: -.s3.http.response-header-timeout - [response_header_timeout: | default = 0s] - - # Set to true to skip verifying the certificate chain and hostname. - # CLI flag: -.s3.http.insecure-skip-verify - [insecure_skip_verify: | default = false] - - # Path to the trusted CA file that signed the SSL certificate of the S3 - # endpoint. - # CLI flag: -.s3.http.ca-file - [ca_file: | default = ""] -``` - -## swift_storage_config - -The `swift_storage_config` configures Swift as a general storage for different data generated by Loki. - -```yaml -# Openstack authentication URL. -# CLI flag: -.swift.auth-url -[auth_url: | default = ""] - -# Openstack username for the api. -# CLI flag: -.swift.username -[username: | default = ""] - -# Openstack user's domain name. -# CLI flag: -.swift.user-domain-name -[user_domain_name: | default = ""] - -# Openstack user's domain ID. -# CLI flag: -.swift.user-domain-id -[user_domain_id: | default = ""] - -# Openstack user ID for the API. -# CLI flag: -.swift.user-id -[user_id: | default = ""] - -# Openstack API key. -# CLI flag: -.swift.password -[password: | default = ""] - -# Openstack user's domain ID. -# CLI flag: -.swift.domain-id -[domain_id: | default = ""] - -# Openstack user's domain name. -# CLI flag: -.swift.domain-name -[domain_name: | default = ""] - -# Openstack project ID (v2,v3 auth only). -# CLI flag: -.swift.project-id -[project_id: | default = ""] - -# Openstack project name (v2,v3 auth only). -# CLI flag: -.swift.project-name -[project_name: | default = ""] - -# ID of the project's domain (v3 auth only), only needed if it differs the -# from user domain. -# CLI flag: -.swift.project-domain-id -[project_domain_id: | default = ""] - -# Name of the project's domain (v3 auth only), only needed if it differs -# from the user domain. -# CLI flag: -.swift.project-domain-name -[project_domain_name: | default = ""] - -# Openstack Region to use eg LON, ORD - default is use first region (v2,v3 -# auth only) -# CLI flag: -.swift.region-name -[region_name: | default = ""] - -# Name of the Swift container to put chunks in. -# CLI flag: -.swift.container-name -[container_name: | default = ""] -``` - -## hedging - -The `hedging` block configures how to hedge storage requests. - -The hedging implementation sends a second storage request once a first request has -been outstanding for more than a configured expected latency for this class of requests. -Calculate your latency to be the 99th percentile of object storage response times. - -```yaml -# An optional duration that sets the quantity of time after a first storage request -# is sent and before a second request is sent, when no response is received for the first -# storage request. The recommended duration is the measured 99th percentile of object -# storage response times, to reduce long tail latency. This option is most impactful -# when used with queriers, and has minimal to no impact on other components. -# The default value of 0 disables the hedging of storage requests. -# Example: "at: 500ms" -[at: | default = 0] - -# An optional maximum quantity of hedged requests to be issued for a given request. -[up_to: | default = 2] - -# Caps the rate of hedged requests by optionally defining the maximum quantity of -# hedged requests issued per second. -[max_per_second: | default = 5] -``` - -## local_storage_config - -The `local_storage_config` configures a (local) file system as a general storage for different data generated by Loki. +wal: + # The directory in which to write tenant WAL files. Each tenant will have its + # own directory one level below this directory. + # CLI flag: -ruler.wal.dir + [dir: | default = "ruler-wal"] -```yaml -# Filesystem directory to be used as storage. -# CLI flag: -.local.directory -[directory: | default = ""] -``` + # Frequency with which to run the WAL truncation process. + # CLI flag: -ruler.wal.truncate-frequency + [truncate_frequency: | default = 1h] -## frontend_worker + # Minimum age that samples must exist in the WAL before being truncated. + # CLI flag: -ruler.wal.min-age + [min_age: | default = 5m] -The `frontend_worker` configures the worker - running within the Loki querier - picking up and executing queries enqueued by the query-frontend. + # Maximum age that samples must exist in the WAL before being truncated. + # CLI flag: -ruler.wal.max-age + [max_age: | default = 4h] -```yaml -# Address of query frontend service, in host:port format. -# CLI flag: -querier.frontend-address -[frontend_address: | default = ""] +wal_cleaner: + # The minimum age of a WAL to consider for cleaning. + # CLI flag: -ruler.wal-cleaner.min-age + [min_age: | default = 12h] -# Number of simultaneous queries to process. -# CLI flag: -querier.worker-parallelism -[parallelism: | default = 10] + # Deprecated: CLI flag -ruler.wal-cleaer.period. + # Use -ruler.wal-cleaner.period instead. + # + # How often to run the WAL cleaner. 0 = disabled. + # CLI flag: -ruler.wal-cleaner.period + [period: | default = 0s] -# Force worker concurrency to match the -querier.max-concurrent option. Overrides querier.worker-parallelism. -# CLI flag: -querier.worker-match-max-concurrent -[match_max_concurrent: | default = true] +# Remote-write configuration to send rule samples to a Prometheus remote-write +# endpoint. +remote_write: + # Deprecated: Use 'clients' instead. Configure remote write client. + [client: ] -# How often to query the frontend_address DNS to resolve frontend addresses. -# Also used to determine how often to poll the scheduler-ring for addresses if configured. -# CLI flag: -querier.dns-lookup-period -[dns_lookup_duration: | default = 3s] + # Configure remote write clients. A map with remote client id as key. + [clients: ] -# The CLI flags prefix for this block config is: querier.frontend-client -[grpc_client_config: ] + # Enable remote-write functionality. + # CLI flag: -ruler.remote-write.enabled + [enabled: | default = false] -# DNS hostname used for finding query-schedulers. -# CLI flag: -querier.scheduler-address -[scheduler_address: | default = ""] + # Minimum period to wait between refreshing remote-write reconfigurations. + # This should be greater than or equivalent to + # -limits.per-user-override-period. + # CLI flag: -ruler.remote-write.config-refresh-period + [config_refresh_period: | default = 10s] ``` -## ingester_client +### ingester_client -The `ingester_client` block configures how connections to ingesters -operate. +The `ingester_client` block configures how the distributor will connect to ingesters. Only appropriate when running all components, the distributor, or the querier. ```yaml -# Configures how connections are pooled +# Configures how connections are pooled. pool_config: - # Whether or not to do health checks. - # CLI flag: -distributor.health-check-ingesters - [health_check_ingesters: | default = false] - - # How frequently to clean up clients for servers that have gone away after - # a health check. + # How frequently to clean up clients for ingesters that have gone away. # CLI flag: -distributor.client-cleanup-period [client_cleanup_period: | default = 15s] - # How quickly a dead client will be removed after it has been detected - # to disappear. Set this to a value to allow time for a secondary - # health check to recover the missing client. + # Run a health check on each ingester client during periodic cleanup. + # CLI flag: -distributor.health-check-ingesters + [health_check_ingesters: | default = true] + + # How quickly a dead client will be removed after it has been detected to + # disappear. Set this to a value to allow time for a secondary health check to + # recover the missing client. # CLI flag: -ingester.client.healthcheck-timeout [remote_timeout: | default = 1s] @@ -1115,23 +1096,23 @@ pool_config: # CLI flag: -ingester.client.timeout [remote_timeout: | default = 5s] -# Configures how the gRPC connection to ingesters work as a client -# The CLI flags prefix for this block config is: ingester.client -[grpc_client_config: ] +# Configures how the gRPC connection to ingesters work as a client. +# The CLI flags prefix for this block configuration is: ingester.client +[grpc_client_config: ] ``` -## ingester +### ingester -The `ingester` block configures the Loki Ingesters. +The `ingester` block configures the ingester and how the ingester will register itself to a key value store. ```yaml -# Configures how the lifecycle of the ingester will operate -# and where it will register for discovery. +# Configures how the lifecycle of the ingester will operate and where it will +# register for discovery. lifecycler: ring: kvstore: # Backend storage to use for the ring. Supported values are: consul, etcd, - # inmemory, memberlist + # inmemory, memberlist, multi. # CLI flag: -ring.store [store: | default = "consul"] @@ -1139,57 +1120,124 @@ lifecycler: # CLI flag: -ring.prefix [prefix: | default = "collectors/"] - # The consul_config configures the consul client. - # CLI flag: - [consul: ] + # Configuration for a Consul client. Only applies if store is consul. + [consul: ] + + # Configuration for an ETCD v3 client. Only applies if store is etcd. + [etcd: ] - # The etcd_config configures the etcd client. - # CLI flag: - [etcd: ] + multi: + # Primary backend storage used by multi-client. + # CLI flag: -multi.primary + [primary: | default = ""] + + # Secondary backend storage used by multi-client. + # CLI flag: -multi.secondary + [secondary: | default = ""] + + # Mirror writes to secondary store. + # CLI flag: -multi.mirror-enabled + [mirror_enabled: | default = false] + + # Timeout for storing value to secondary store. + # CLI flag: -multi.mirror-timeout + [mirror_timeout: | default = 2s] # The heartbeat timeout after which ingesters are skipped for reads/writes. + # 0 = never (timeout disabled). # CLI flag: -ring.heartbeat-timeout [heartbeat_timeout: | default = 1m] # The number of ingesters to write to and read from. - # CLI flag: -ingester.replication-factor + # CLI flag: -distributor.replication-factor [replication_factor: | default = 3] - # The number of tokens the lifecycler will generate and put into the ring if - # it joined without transferring tokens from another lifecycler. + # True to enable the zone-awareness and replicate ingested samples across + # different availability zones. + # CLI flag: -distributor.zone-awareness-enabled + [zone_awareness_enabled: | default = false] + + # Comma-separated list of zones to exclude from the ring. Instances in + # excluded zones will be filtered out from the ring. + # CLI flag: -distributor.excluded-zones + [excluded_zones: | default = ""] + + # Number of tokens for each ingester. # CLI flag: -ingester.num-tokens [num_tokens: | default = 128] - # Period at which to heartbeat to the underlying ring. + # Period at which to heartbeat to consul. 0 = disabled. # CLI flag: -ingester.heartbeat-period [heartbeat_period: | default = 5s] - # How long to wait to claim tokens and chunks from another member when - # that member is leaving. Will join automatically after the duration expires. - # CLI flag: -ingester.join-after - [join_after: | default = 0s] + # Heartbeat timeout after which instance is assumed to be unhealthy. 0 = + # disabled. + # CLI flag: -ingester.heartbeat-timeout + [heartbeat_timeout: | default = 1m] - # Observe tokens after generating to resolve collisions. Useful when using a gossip ring. + # Observe tokens after generating to resolve collisions. Useful when using + # gossiping ring. # CLI flag: -ingester.observe-period [observe_period: | default = 0s] - # Minimum duration to wait before becoming ready. This is to work around race - # conditions with ingesters exiting and updating the ring. + # Period to wait for a claim from another member; will join automatically + # after this. + # CLI flag: -ingester.join-after + [join_after: | default = 0s] + + # Minimum duration to wait after the internal readiness checks have passed but + # before succeeding the readiness endpoint. This is used to slowdown + # deployment controllers (eg. Kubernetes) after an instance is ready and + # before they proceed with a rolling update, to give the rest of the cluster + # instances enough time to receive ring updates. # CLI flag: -ingester.min-ready-duration [min_ready_duration: | default = 15s] - # Name of network interfaces to read addresses from. + # Name of network interface to read address from. # CLI flag: -ingester.lifecycler.interface - interface_names: - - - [ ... | default = []] + [interface_names: | default = []] - # Duration to sleep before exiting to ensure metrics are scraped. + # Duration to sleep for before exiting, to ensure metrics are scraped. # CLI flag: -ingester.final-sleep - [final_sleep: | default = 30s] - -# Number of times to try and transfer chunks when leaving before -# falling back to flushing to the store. Zero = no transfers are done. + [final_sleep: | default = 0s] + + # File path where tokens are stored. If empty, tokens are not stored at + # shutdown and restored at startup. + # CLI flag: -ingester.tokens-file-path + [tokens_file_path: | default = ""] + + # The availability zone where this instance is running. + # CLI flag: -ingester.availability-zone + [availability_zone: | default = ""] + + # Unregister from the ring upon clean shutdown. It can be useful to disable + # for rolling restarts with consistent naming in conjunction with + # -distributor.extend-writes=false. + # CLI flag: -ingester.unregister-on-shutdown + [unregister_on_shutdown: | default = true] + + # When enabled the readiness probe succeeds only after all instances are + # ACTIVE and healthy in the ring, otherwise only the instance itself is + # checked. This option should be disabled if in your cluster multiple + # instances can be rolled out simultaneously, otherwise rolling updates may be + # slowed down. + # CLI flag: -ingester.readiness-check-ring-health + [readiness_check_ring_health: | default = true] + + # IP address to advertise in the ring. + # CLI flag: -ingester.lifecycler.addr + [address: | default = ""] + + # port to advertise in consul (defaults to server.grpc-listen-port). + # CLI flag: -ingester.lifecycler.port + [port: | default = 0] + + # ID to register in the ring. + # CLI flag: -ingester.lifecycler.ID + [id: | default = ""] + +# Number of times to try and transfer chunks before falling back to flushing. If +# set to 0 or negative value, transfers are disabled. # CLI flag: -ingester.max-transfer-retries [max_transfer_retries: | default = 0] @@ -1197,11 +1245,11 @@ lifecycler: # CLI flag: -ingester.concurrent-flushes [concurrent_flushes: | default = 32] -# How often should the ingester see if there are any blocks to flush +# How often should the ingester see if there are any blocks to flush. # CLI flag: -ingester.flush-check-period [flush_check_period: | default = 30s] -# The timeout before a flush is cancelled +# The timeout before a flush is cancelled. # CLI flag: -ingester.flush-op-timeout [flush_op_timeout: | default = 10m] @@ -1209,268 +1257,294 @@ lifecycler: # CLI flag: -ingester.chunks-retain-period [chunk_retain_period: | default = 0s] -# How long chunks should sit in-memory with no updates before -# being flushed if they don't hit the max block size. This means -# that half-empty chunks will still be flushed after a certain -# period as long as they receive no further activity. +# How long chunks should sit in-memory with no updates before being flushed if +# they don't hit the max block size. This means that half-empty chunks will +# still be flushed after a certain period as long as they receive no further +# activity. # CLI flag: -ingester.chunks-idle-period [chunk_idle_period: | default = 30m] -# The targeted _uncompressed_ size in bytes of a chunk block -# When this threshold is exceeded the head block will be cut and compressed inside the chunk. +# The targeted _uncompressed_ size in bytes of a chunk block When this threshold +# is exceeded the head block will be cut and compressed inside the chunk. # CLI flag: -ingester.chunks-block-size [chunk_block_size: | default = 262144] -# A target _compressed_ size in bytes for chunks. -# This is a desired size not an exact size, chunks may be slightly bigger -# or significantly smaller if they get flushed for other reasons (e.g. chunk_idle_period) -# A value of 0 creates chunks with a fixed 10 blocks, -# A non zero value will create chunks with a variable number of blocks to meet the target size. +# A target _compressed_ size in bytes for chunks. This is a desired size not an +# exact size, chunks may be slightly bigger or significantly smaller if they get +# flushed for other reasons (e.g. chunk_idle_period). A value of 0 creates +# chunks with a fixed 10 blocks, a non zero value will create chunks with a +# variable number of blocks to meet the target size. # CLI flag: -ingester.chunk-target-size [chunk_target_size: | default = 1572864] -# The compression algorithm to use for chunks. (supported: gzip, lz4, snappy) -# You should choose your algorithm depending on your need: -# - `gzip` highest compression ratio but also slowest decompression speed. (144 kB per chunk) -# - `lz4` fastest compression speed (188 kB per chunk) -# - `snappy` fast and popular compression algorithm (272 kB per chunk) +# The algorithm to use for compressing chunk. (none, gzip, lz4-64k, snappy, +# lz4-256k, lz4-1M, lz4, flate, zstd) # CLI flag: -ingester.chunk-encoding -[chunk_encoding: | default = gzip] +[chunk_encoding: | default = "gzip"] + +# The maximum duration of a timeseries chunk in memory. If a timeseries runs for +# longer than this, the current chunk will be flushed to the store and a new +# chunk created. +# CLI flag: -ingester.max-chunk-age +[max_chunk_age: | default = 2h] + +# Forget about ingesters having heartbeat timestamps older than +# `ring.kvstore.heartbeat_timeout`. This is equivalent to clicking on the +# `/ring` `forget` button in the UI: the ingester is removed from the ring. This +# is a useful setting when you are sure that an unhealthy node won't return. An +# example is when not using stateful sets or the equivalent. Use +# `memberlist.rejoin_interval` > 0 to handle network partition cases when using +# a memberlist. +# CLI flag: -ingester.autoforget-unhealthy +[autoforget_unhealthy: | default = false] # Parameters used to synchronize ingesters to cut chunks at the same moment. -# Sync period is used to roll over incoming entry to a new chunk. If chunk's utilization -# isn't high enough (eg. less than 50% when sync_min_utilization is set to 0.5), then -# this chunk rollover doesn't happen. +# Sync period is used to roll over incoming entry to a new chunk. If chunk's +# utilization isn't high enough (eg. less than 50% when sync_min_utilization is +# set to 0.5), then this chunk rollover doesn't happen. # CLI flag: -ingester.sync-period -[sync_period: | default = 0] +[sync_period: | default = 0s] +# Minimum utilization of chunk when doing synchronization. # CLI flag: -ingester.sync-min-utilization -[sync_min_utilization: | Default = 0] +[sync_min_utilization: | default = 0] -# The maximum number of errors a stream will report to the user -# when a push fails. 0 to make unlimited. +# The maximum number of errors a stream will report to the user when a push +# fails. 0 to make unlimited. # CLI flag: -ingester.max-ignored-stream-errors [max_returned_stream_errors: | default = 10] -# The maximum duration of a timeseries chunk in memory. If a timeseries runs for longer than this, -# the current chunk will be flushed to the store and a new chunk created. -# CLI flag: -ingester.max-chunk-age -[max_chunk_age: | default = 2h] - -# How far in the past an ingester is allowed to query the store for data. -# This is only useful for running multiple Loki binaries with a shared ring -# with a `filesystem` store, which is NOT shared between the binaries. -# When using any "shared" object store like S3 or GCS, this value must always be left as 0. -# It is an error to configure this to a non-zero value when using any object store other -# than `filesystem`. -# Use a value of -1 to allow the ingester to query the store infinitely far back in time. +# How far back should an ingester be allowed to query the store for data, for +# use only with boltdb-shipper/tsdb index and filesystem object store. -1 for +# infinite. # CLI flag: -ingester.query-store-max-look-back-period -[query_store_max_look_back_period: | default = 0] - -# Forget about ingesters having heartbeat timestamps older than `ring.kvstore.heartbeat_timeout`. -# This is equivalent to clicking on the `/ring` `forget` button in the UI: -# the ingester is removed from the ring. -# This is a useful setting when you are sure that an unhealthy node won't return. -# An example is when not using stateful sets or the equivalent. -# Use `memberlist.rejoin_interval` > 0 to handle network partition cases when using a memberlist. -# CLI flag: -ingester.autoforget-unhealthy -[autoforget_unhealthy: | default = false] +[query_store_max_look_back_period: | default = 0s] # The ingester WAL (Write Ahead Log) records incoming logs and stores them on # the local file systems in order to guarantee persistence of acknowledged data # in the event of a process crash. wal: - # Enables writing to WAL. + # Enable writing of ingested data into WAL. # CLI flag: -ingester.wal-enabled [enabled: | default = true] - # Directory where the WAL data should be stored and/or recovered from. + # Directory where the WAL data is stored and/or recovered from. # CLI flag: -ingester.wal-dir - [dir: | default = "wal"] - - # When WAL is enabled, should chunks be flushed to long-term storage on shutdown. - # CLI flag: -ingester.flush-on-shutdown - [flush_on_shutdown: | default = false] + [dir: | default = "wal"] # Interval at which checkpoints should be created. - # CLI flag: ingester.checkpoint-duration + # CLI flag: -ingester.checkpoint-duration [checkpoint_duration: | default = 5m] - # Maximum memory size the WAL may use during replay. After hitting this, - # it will flush data to storage before continuing. - # A unit suffix (KB, MB, GB) may be applied. - [replay_memory_ceiling: | default = 4GB] + # When WAL is enabled, should chunks be flushed to long-term storage on + # shutdown. + # CLI flag: -ingester.flush-on-shutdown + [flush_on_shutdown: | default = false] + + # Maximum memory size the WAL may use during replay. After hitting this, it + # will flush data to storage before continuing. A unit suffix (KB, MB, GB) may + # be applied. + # CLI flag: -ingester.wal-replay-memory-ceiling + [replay_memory_ceiling: | default = 4GB] -# Shard factor used in the ingesters for the in process reverse index. -# This MUST be evenly divisible by ALL schema shard factors or Loki will not start. +# Shard factor used in the ingesters for the in process reverse index. This MUST +# be evenly divisible by ALL schema shard factors or Loki will not start. +# CLI flag: -ingester.index-shards [index_shards: | default = 32] + +# Maximum number of dropped streams to keep in memory during tailing. +# CLI flag: -ingester.tailer.max-dropped-streams +[max_dropped_streams: | default = 10] ``` -## consul_config +### index_gateway -The `consul_config` configures the consul client. The supported CLI flags used to reference this config block are: +The `index_gateway` block configures the Loki index gateway server, responsible for serving index queries without the need to constantly interact with the object store. ```yaml - # The hostname and port of Consul. -# CLI flag: -.consul.hostname -[host: | default = "localhost:8500"] +# Defines in which mode the index gateway server will operate (default to +# 'simple'). It supports two modes: +# - 'simple': an index gateway server instance is responsible for handling, +# storing and returning requests for all indices for all tenants. +# - 'ring': an index gateway server instance is responsible for a subset of +# tenants instead of all tenants. +# CLI flag: -index-gateway.mode +[mode: | default = "simple"] + +# Defines the ring to be used by the index gateway servers and clients in case +# the servers are configured to run in 'ring' mode. In case this isn't +# configured, this block supports inheriting configuration from the common ring +# section. +ring: + kvstore: + # Backend storage to use for the ring. Supported values are: consul, etcd, + # inmemory, memberlist, multi. + # CLI flag: -index-gateway.ring.store + [store: | default = "consul"] -# The ACL Token used to interact with Consul. -# CLI flag: -.consul.acl-token -[acl_token: ] + # The prefix for the keys in the store. Should end with a /. + # CLI flag: -index-gateway.ring.prefix + [prefix: | default = "collectors/"] -# The HTTP timeout when communicating with Consul -# CLI flag: -.consul.client-timeout -[http_client_timeout: | default = 20s] + # Configuration for a Consul client. Only applies if store is consul. + # The CLI flags prefix for this block configuration is: index-gateway.ring + [consul: ] -# Whether or not consistent reads to Consul are enabled. -# CLI flag: -.consul.consistent-reads -[consistent_reads: | default = true] -``` + # Configuration for an ETCD v3 client. Only applies if store is etcd. + # The CLI flags prefix for this block configuration is: index-gateway.ring + [etcd: ] -## etcd_config + multi: + # Primary backend storage used by multi-client. + # CLI flag: -index-gateway.ring.multi.primary + [primary: | default = ""] -The `etcd_config` configures the etcd client. The supported CLI flags used to reference this config block are: + # Secondary backend storage used by multi-client. + # CLI flag: -index-gateway.ring.multi.secondary + [secondary: | default = ""] -```yaml -# The etcd endpoints to connect to. -# CLI flag: -.etcd.endpoints -[endpoints: | default = []] + # Mirror writes to secondary store. + # CLI flag: -index-gateway.ring.multi.mirror-enabled + [mirror_enabled: | default = false] -# The dial timeout for the etcd connection. -# CLI flag: -.etcd.dial-timeout -[dial_timeout: | default = 10s] + # Timeout for storing value to secondary store. + # CLI flag: -index-gateway.ring.multi.mirror-timeout + [mirror_timeout: | default = 2s] -# The maximum number of retries to do for failed ops. -# CLI flag: -.etcd.max-retries -[max_retries: | default = 10] -``` + # Period at which to heartbeat to the ring. 0 = disabled. + # CLI flag: -index-gateway.ring.heartbeat-period + [heartbeat_period: | default = 15s] -## memberlist_config + # The heartbeat timeout after which compactors are considered unhealthy within + # the ring. 0 = never (timeout disabled). + # CLI flag: -index-gateway.ring.heartbeat-timeout + [heartbeat_timeout: | default = 1m] -The `memberlist_config` block configures the gossip ring to discover and connect -between distributors, ingesters and queriers. The configuration is unique for all -three components to ensure a single shared ring. + # File path where tokens are stored. If empty, tokens are not stored at + # shutdown and restored at startup. + # CLI flag: -index-gateway.ring.tokens-file-path + [tokens_file_path: | default = ""] -When a `memberlist_config` with least 1 `join_members` is defined, a `kvstore` of type `memberlist` is -automatically configured for the `distributor`, `ingester`, and `ruler` rings unless otherwise specified in -those components specific configuration sections. + # True to enable zone-awareness and replicate blocks across different + # availability zones. + # CLI flag: -index-gateway.ring.zone-awareness-enabled + [zone_awareness_enabled: | default = false] -```yaml -# Name of the node in memberlist cluster. Defaults to hostname. -# CLI flag: -memberlist.nodename -[node_name: | default = ""] - -# Add random suffix to the node name. -# CLI flag: -memberlist.randomize-node-name -[randomize_node_name: | default = true] - -# The timeout for establishing a connection with a remote node, and for -# read/write operations. Uses memberlist LAN defaults if 0. -# CLI flag: -memberlist.stream-timeout -[stream_timeout: | default = 0s] - -# Multiplication factor used when sending out messages (factor * log(N+1)). -# CLI flag: -memberlist.retransmit-factor -[retransmit_factor: | default = 0] - -# How often to use pull/push sync. Uses memberlist LAN defaults if 0. -# CLI flag: -memberlist.pullpush-interval -[pull_push_interval: | default = 0s] - -# How often to gossip. Uses memberlist LAN defaults if 0. -# CLI flag: -memberlist.gossip-interval -[gossip_interval: | default = 0s] - -# How many nodes to gossip to. Uses memberlist LAN defaults if 0. -# CLI flag: -memberlist.gossip-nodes -[gossip_nodes: | default = 0] - -# How long to keep gossiping to dead nodes, to give them chance to refute their -# death. Uses memberlist LAN defaults if 0. -# CLI flag: -memberlist.gossip-to-dead-nodes-time -[gossip_to_dead_nodes_time: | default = 0s] - -# How soon can dead node's name be reclaimed with new address. Defaults to 0, -# which is disabled. -# CLI flag: -memberlist.dead-node-reclaim-time -[dead_node_reclaim_time: | default = 0s] - -# Other cluster members to join. Can be specified multiple times. It can be an -# IP, hostname or an entry specified in the DNS Service Discovery format (see -# https://grafana.com/docs/mimir/latest/operators-guide/configuring/about-dns-service-discovery/ -# for more details). -# CLI flag: -memberlist.join -[join_members: | default = ] - -# Min backoff duration to join other cluster members. -# CLI flag: -memberlist.min-join-backoff -[min_join_backoff: | default = 1s] - -# Max backoff duration to join other cluster members. -# CLI flag: -memberlist.max-join-backoff -[max_join_backoff: | default = 1m] - -# Max number of retries to join other cluster members. -# CLI flag: -memberlist.max-join-retries -[max_join_retries: | default = 10] - -# If this node fails to join memberlist cluster, abort. -# CLI flag: -memberlist.abort-if-join-fails -[abort_if_cluster_join_fails: | default = true] - -# If not 0, how often to rejoin the cluster. Occasional rejoin can help to fix -# the cluster split issue, and is harmless otherwise. For example when using -# only few components as a seed nodes (via -memberlist.join), then it's -# recommended to use rejoin. If -memberlist.join points to dynamic service that -# resolves to all gossiping nodes (eg. Kubernetes headless service), then rejoin -# is not needed. -# CLI flag: -memberlist.rejoin-interval -[rejoin_interval: | default = 0s] - -# How long to keep LEFT ingesters in the ring. -# CLI flag: -memberlist.left-ingesters-timeout -[left_ingesters_timeout: | default = 5m] - -# Timeout for leaving memberlist cluster. -# CLI flag: -memberlist.leave-timeout -[leave_timeout: | default = 5s] - -# IP address to listen on for gossip messages. Multiple addresses may be -# specified. Defaults to 0.0.0.0 -# CLI flag: -memberlist.bind-addr -[bind_addr: | default = ] - -# Port to listen on for gossip messages. -# CLI flag: -memberlist.bind-port -[bind_port: | default = 7946] - -# Timeout used when connecting to other nodes to send packet. -# CLI flag: -memberlist.packet-dial-timeout -[packet_dial_timeout: | default = 5s] - -# Timeout for writing 'packet' data. -# CLI flag: -memberlist.packet-write-timeout -[packet_write_timeout: | default = 5s] + # Instance ID to register in the ring. + # CLI flag: -index-gateway.ring.instance-id + [instance_id: | default = ""] + + # Name of network interface to read address from. + # CLI flag: -index-gateway.ring.instance-interface-names + [instance_interface_names: | default = []] + + # Port to advertise in the ring (defaults to server.grpc-listen-port). + # CLI flag: -index-gateway.ring.instance-port + [instance_port: | default = 0] + + # IP address to advertise in the ring. + # CLI flag: -index-gateway.ring.instance-addr + [instance_addr: | default = ""] + + # The availability zone where this instance is running. Required if + # zone-awareness is enabled. + # CLI flag: -index-gateway.ring.instance-availability-zone + [instance_availability_zone: | default = ""] + + # How many index gateway instances are assigned to each tenant. + # CLI flag: -replication-factor + [replication_factor: | default = 3] ``` -## storage_config +### storage_config -The `storage_config` block configures one of many possible stores for both the -index and chunks. Which configuration to be picked should be defined in schema_config -block. +The `storage_config` block configures one of many possible stores for both the index and chunks. Which configuration to be picked should be defined in schema_config block. ```yaml # Configures storing chunks in AWS. Required options only required when aws is # present. aws: - # S3 or S3-compatible endpoint URL with escaped Key and Secret encoded. - # If only region is specified as a host, the proper endpoint will be deduced. - # Use inmemory:/// to use a mock in-memory implementation. + dynamodb: + # DynamoDB endpoint URL with escaped Key and Secret encoded. If only region + # is specified as a host, proper endpoint will be deduced. Use + # inmemory:/// to use a mock in-memory implementation. + # CLI flag: -dynamodb.url + [dynamodb_url: ] + + # DynamoDB table management requests per second limit. + # CLI flag: -dynamodb.api-limit + [api_limit: | default = 2] + + # DynamoDB rate cap to back off when throttled. + # CLI flag: -dynamodb.throttle-limit + [throttle_limit: | default = 10] + + metrics: + # Use metrics-based autoscaling, via this query URL + # CLI flag: -metrics.url + [url: | default = ""] + + # Queue length above which we will scale up capacity + # CLI flag: -metrics.target-queue-length + [target_queue_length: | default = 100000] + + # Scale up capacity by this multiple + # CLI flag: -metrics.scale-up-factor + [scale_up_factor: | default = 1.3] + + # Ignore throttling below this level (rate per second) + # CLI flag: -metrics.ignore-throttle-below + [ignore_throttle_below: | default = 1] + + # query to fetch ingester queue length + # CLI flag: -metrics.queue-length-query + [queue_length_query: | default = "sum(avg_over_time(cortex_ingester_flush_queue_length{job=\"cortex/ingester\"}[2m]))"] + + # query to fetch throttle rates per table + # CLI flag: -metrics.write-throttle-query + [write_throttle_query: | default = "sum(rate(cortex_dynamo_throttled_total{operation=\"DynamoDB.BatchWriteItem\"}[1m])) by (table) > 0"] + + # query to fetch write capacity usage per table + # CLI flag: -metrics.usage-query + [write_usage_query: | default = "sum(rate(cortex_dynamo_consumed_capacity_total{operation=\"DynamoDB.BatchWriteItem\"}[15m])) by (table) > 0"] + + # query to fetch read capacity usage per table + # CLI flag: -metrics.read-usage-query + [read_usage_query: | default = "sum(rate(cortex_dynamo_consumed_capacity_total{operation=\"DynamoDB.QueryPages\"}[1h])) by (table) > 0"] + + # query to fetch read errors per table + # CLI flag: -metrics.read-error-query + [read_error_query: | default = "sum(increase(cortex_dynamo_failures_total{operation=\"DynamoDB.QueryPages\",error=\"ProvisionedThroughputExceededException\"}[1m])) by (table) > 0"] + + # Number of chunks to group together to parallelise fetches (zero to + # disable) + # CLI flag: -dynamodb.chunk-gang-size + [chunk_gang_size: | default = 10] + + # Max number of chunk-get operations to start in parallel + # CLI flag: -dynamodb.chunk.get-max-parallelism + [chunk_get_max_parallelism: | default = 32] + + backoff_config: + # Minimum backoff time + # CLI flag: -dynamodb.min-backoff + [min_period: | default = 100ms] + + # Maximum backoff time + # CLI flag: -dynamodb.max-backoff + [max_period: | default = 50s] + + # Maximum number of times to retry an operation + # CLI flag: -dynamodb.max-retries + [max_retries: | default = 20] + + # S3 endpoint URL with escaped Key and Secret encoded. If only region is + # specified as a host, proper endpoint will be deduced. Use + # inmemory:/// to use a mock in-memory implementation. # CLI flag: -s3.url - [s3: ] + [s3: ] - # Set to true to force the request to use path-style addressing + # Set this to `true` to force the request to use path-style addressing. # CLI flag: -s3.force-path-style [s3forcepathstyle: | default = false] @@ -1487,19 +1561,20 @@ aws: # CLI flag: -s3.region [region: | default = ""] - # AWS Access Key ID. + # AWS Access Key ID # CLI flag: -s3.access-key-id [access_key_id: | default = ""] - # AWS Secret Access Key. + # AWS Secret Access Key # CLI flag: -s3.secret-access-key [secret_access_key: | default = ""] - # Disable https on S3 connection. + # Disable https on s3 connection. # CLI flag: -s3.insecure [insecure: | default = false] - # Enable AES256 AWS Server Side Encryption. + # Enable AWS Server Side Encryption [Deprecated: Use .sse instead. if + # s3.sse-encryption is enabled, it assumes .sse.type SSE-S3] # CLI flag: -s3.sse-encryption [sse_encryption: | default = false] @@ -1522,253 +1597,279 @@ aws: # CLI flag: -s3.http.ca-file [ca_file: | default = ""] - # Configures back off when s3 get Object. - backoff_config: - # Minimum duration to back off. - # CLI flag: -s3.backoff-min-period - [min_period: | default = 100ms] - - # The duration to back off. - # CLI flag: -s3.backoff-max-period - [max_period: | default = 3s] - - # Number of times to back off and retry before failing. - # CLI flag: -s3.backoff-retries - [max_retries: | default = 5] - - # Configure the DynamoDB connection - dynamodb: - # URL for DynamoDB with escaped Key and Secret encoded. If only region is specified as a - # host, the proper endpoint will be deduced. Use inmemory:/// to - # use a mock in-memory implementation. - # CLI flag: -dynamodb.url - dynamodb_url: + # The signature version to use for authenticating against S3. Supported values + # are: v4, v2. + # CLI flag: -s3.signature-version + [signature_version: | default = "v4"] - # DynamoDB table management requests per-second limit. - # CLI flag: -dynamodb.api-limit - [api_limit: | default = 2.0] + sse: + # Enable AWS Server Side Encryption. Supported values: SSE-KMS, SSE-S3. + # CLI flag: -s3.sse.type + [type: | default = ""] - # DynamoDB rate cap to back off when throttled. - # CLI flag: -dynamodb.throttle-limit - [throttle_limit: | default = 10.0] + # KMS Key ID used to encrypt objects in S3 + # CLI flag: -s3.sse.kms-key-id + [kms_key_id: | default = ""] - # Metrics-based autoscaling configuration. - metrics: - # Use metrics-based autoscaling via this Prometheus query URL. - # CLI flag: -metrics.url - [url: ] + # KMS Encryption Context used for object encryption. It expects JSON + # formatted string. + # CLI flag: -s3.sse.kms-encryption-context + [kms_encryption_context: | default = ""] - # Queue length above which we will scale up capacity. - # CLI flag: -metrics.target-queue-length - [target_queue_length: | default = 100000] + # Configures back off when S3 get Object. + backoff_config: + # Minimum backoff time when s3 get Object + # CLI flag: -s3.min-backoff + [min_period: | default = 100ms] - # Scale up capacity by this multiple - # CLI flag: -metrics.scale-up-factor - [scale_up_factor: | default = 1.3] + # Maximum backoff time when s3 get Object + # CLI flag: -s3.max-backoff + [max_period: | default = 3s] - # Ignore throttling below this level (rate per second) - # CLI flag: -metrics.ignore-throttle-below - [ignore_throttle_below: | default = 1] + # Maximum number of times to retry when s3 get Object + # CLI flag: -s3.max-retries + [max_retries: | default = 5] - # Number of chunks to group together to parallelise fetches (0 to disable) - # CLI flag: -dynamodb.chunk-gang-size - [chunk_gang_size: | default = 10] +# The azure_storage_config block configures the connection to Azure object +# storage backend. +[azure: ] - # Max number of chunk get operations to start in parallel. - # CLI flag: -dynamodb.chunk.get-max-parallelism - [chunk_get_max_parallelism: | default = 32] +# The bos_storage_config block configures the connection to Baidu Object Storage +# (BOS) object storage backend. +[bos: ] -# Configures storing indexes in Bigtable. Required fields only required -# when bigtable is defined in config. +# Configures storing indexes in Bigtable. Required fields only required when +# bigtable is defined in config. bigtable: - # BigTable project ID - # CLI flag: -bigtable.project - project: + # Bigtable project ID. + # CLI flag: -bigtable.project + [project: | default = ""] - # BigTable instance ID + # Bigtable instance ID. Please refer to + # https://cloud.google.com/docs/authentication/production for more information + # about how to configure authentication. # CLI flag: -bigtable.instance - instance: + [instance: | default = ""] - # Configures the gRPC client used to connect to Bigtable. - # The CLI flags prefix for this block config is: bigtable - [grpc_client_config: ] + # The grpc_client block configures the gRPC client used to communicate between + # two Loki components. + # The CLI flags prefix for this block configuration is: bigtable + [grpc_client_config: ] -# Configures storing chunks in GCS. Required fields only required -# when gcs is defined in config. -gcs: - # Name of GCS bucket to put chunks in. - # CLI flag: -gcs.bucketname - bucket_name: + # If enabled, once a tables info is fetched, it is cached. + # CLI flag: -bigtable.table-cache.enabled + [table_cache_enabled: | default = true] - # The size of the buffer that the GCS client uses for each PUT request. 0 - # to disable buffering. - # CLI flag: -gcs.chunk-buffer-size - [chunk_buffer_size: | default = 0] + # Duration to cache tables before checking again. + # CLI flag: -bigtable.table-cache.expiration + [table_cache_expiration: | default = 30m] - # The duration after which the requests to GCS should be timed out. - # CLI flag: -gcs.request-timeout - [request_timeout: | default = 0s] +# Configures storing chunks in GCS. Required fields only required when gcs is +# defined in config. +[gcs: ] -# Configures storing chunks and/or the index in Cassandra +# Configures storing chunks and/or the index in Cassandra. cassandra: - # Comma-separated hostnames or IPs of Cassandra instances + # Comma-separated hostnames or IPs of Cassandra instances. # CLI flag: -cassandra.addresses - addresses: + [addresses: | default = ""] - # Port that cassandra is running on + # Port that Cassandra is running on # CLI flag: -cassandra.port [port: | default = 9042] - # Keyspace to use in Cassandra + # Keyspace to use in Cassandra. # CLI flag: -cassandra.keyspace - keyspace: + [keyspace: | default = ""] - # Consistency level for Cassandra + # Consistency level for Cassandra. # CLI flag: -cassandra.consistency [consistency: | default = "QUORUM"] # Replication factor to use in Cassandra. # CLI flag: -cassandra.replication-factor - [replication_factor: | default = 1] + [replication_factor: | default = 3] - # Instruct the Cassandra driver to not attempt to get host - # info from the system.peers table. + # Instruct the cassandra driver to not attempt to get host info from the + # system.peers table. # CLI flag: -cassandra.disable-initial-host-lookup [disable_initial_host_lookup: | default = false] - # Use SSL when connecting to Cassandra instances. + # Use SSL when connecting to cassandra instances. # CLI flag: -cassandra.ssl [SSL: | default = false] - # Require SSL certificate validation when SSL is enabled. + # Require SSL certificate validation. # CLI flag: -cassandra.host-verification [host_verification: | default = true] - # Path to CA certificate file to verify the peer when SSL is enabled. + # Policy for selecting Cassandra host. Supported values are: round-robin, + # token-aware. + # CLI flag: -cassandra.host-selection-policy + [host_selection_policy: | default = "round-robin"] + + # Path to certificate file to verify the peer. # CLI flag: -cassandra.ca-path - [CA_path: ] + [CA_path: | default = ""] - # Path to client certificate file when SSL is enabled. + # Path to certificate file used by TLS. # CLI flag: -cassandra.tls-cert-path - [tls_cert_path: ] + [tls_cert_path: | default = ""] - # Path to key certificate file when SSL is enabled. + # Path to private key file used by TLS. # CLI flag: -cassandra.tls-key-path - [tls_key_path: ] + [tls_key_path: | default = ""] - # Enable password authentication when connecting to Cassandra. + # Enable password authentication when connecting to cassandra. # CLI flag: -cassandra.auth [auth: | default = false] - # Username for password authentication when auth is true. + # Username to use when connecting to cassandra. # CLI flag: -cassandra.username - [username: ] + [username: | default = ""] - # Password for password authentication when auth is true. + # Password to use when connecting to cassandra. # CLI flag: -cassandra.password - [password: ] - - # Timeout when connecting to Cassandra. - # CLI flag: -cassandra.timeout - [timeout: | default = 600ms] - - # Initial connection timeout during initial dial to server. - # CLI flag: -cassandra.connect-timeout - [connect_timeout: | default = 600ms] - -swift: - # Openstack authentication URL. - # CLI flag: -ruler.storage.swift.auth-url - [auth_url: | default = ""] + [password: | default = ""] - # Openstack username for the api. - # CLI flag: -ruler.storage.swift.username - [username: | default = ""] + # File containing password to use when connecting to cassandra. + # CLI flag: -cassandra.password-file + [password_file: | default = ""] - # Openstack user's domain name. - # CLI flag: -ruler.storage.swift.user-domain-name - [user_domain_name: | default = ""] + # If set, when authenticating with cassandra a custom authenticator will be + # expected during the handshake. This flag can be set multiple times. + # CLI flag: -cassandra.custom-authenticator + [custom_authenticators: | default = []] - # Openstack user's domain id. - # CLI flag: -ruler.storage.swift.user-domain-id - [user_domain_id: | default = ""] + # Timeout when connecting to cassandra. + # CLI flag: -cassandra.timeout + [timeout: | default = 2s] - # Openstack userid for the api. - # CLI flag: -ruler.storage.swift.user-id - [user_id: | default = ""] + # Initial connection timeout, used during initial dial to server. + # CLI flag: -cassandra.connect-timeout + [connect_timeout: | default = 5s] + + # Interval to retry connecting to cassandra nodes marked as DOWN. + # CLI flag: -cassandra.reconnent-interval + [reconnect_interval: | default = 1s] + + # Number of retries to perform on a request. Set to 0 to disable retries. + # CLI flag: -cassandra.max-retries + [max_retries: | default = 0] + + # Maximum time to wait before retrying a failed request. + # CLI flag: -cassandra.retry-max-backoff + [retry_max_backoff: | default = 10s] + + # Minimum time to wait before retrying a failed request. + # CLI flag: -cassandra.retry-min-backoff + [retry_min_backoff: | default = 100ms] + + # Limit number of concurrent queries to Cassandra. Set to 0 to disable the + # limit. + # CLI flag: -cassandra.query-concurrency + [query_concurrency: | default = 0] + + # Number of TCP connections per host. + # CLI flag: -cassandra.num-connections + [num_connections: | default = 2] + + # Convict hosts of being down on failure. + # CLI flag: -cassandra.convict-hosts-on-failure + [convict_hosts_on_failure: | default = true] + + # Table options used to create index or chunk tables. This value is used as + # plain text in the table `WITH` like this, "CREATE TABLE + # (...) WITH ". For details, + # see https://cortexmetrics.io/docs/production/cassandra. By default it will + # use the default table options of your Cassandra cluster. + # CLI flag: -cassandra.table-options + [table_options: | default = ""] + +# Configures storing index in BoltDB. Required fields only required when boltdb +# is present in the configuration. +boltdb: + # Location of BoltDB index files. + # CLI flag: -boltdb.dir + [directory: | default = ""] - # Openstack api key. - # CLI flag: -ruler.storage.swift.password - [password: | default = ""] +# Configures storing the chunks on the local file system. Required fields only +# required when filesystem is present in the configuration. +filesystem: + # Directory to store chunks in. + # CLI flag: -local.chunk-directory + [directory: | default = ""] - # Openstack user's domain id. - # CLI flag: -ruler.storage.swift.domain-id - [domain_id: | default = ""] +# The swift_storage_config block configures the connection to OpenStack Object +# Storage (Swift) object storage backend. +[swift: ] - # Openstack user's domain name. - # CLI flag: -ruler.storage.swift.domain-name - [domain_name: | default = ""] +grpc_store: + # Hostname or IP of the gRPC store instance. + # CLI flag: -grpc-store.server-address + [server_address: | default = ""] - # Openstack project id (v2,v3 auth only). - # CLI flag: -ruler.storage.swift.project-id - [project_id: | default = ""] +hedging: + # If set to a non-zero value a second request will be issued at the provided + # duration. Default is 0 (disabled) + # CLI flag: -store.hedge-requests-at + [at: | default = 0s] - # Openstack project name (v2,v3 auth only). - # CLI flag: -ruler.storage.swift.project-name - [project_name: | default = ""] + # The maximum of hedge requests allowed. + # CLI flag: -store.hedge-requests-up-to + [up_to: | default = 2] - # Id of the project's domain (v3 auth only), only needed if it differs the - # from user domain. - # CLI flag: -ruler.storage.swift.project-domain-id - [project_domain_id: | default = ""] + # The maximum of hedge requests allowed per seconds. + # CLI flag: -store.hedge-max-per-second + [max_per_second: | default = 5] - # Name of the project's domain (v3 auth only), only needed if it differs - # from the user domain. - # CLI flag: -ruler.storage.swift.project-domain-name - [project_domain_name: | default = ""] +# Cache validity for active index entries. Should be no higher than +# -ingester.max-chunk-idle. +# CLI flag: -store.index-cache-validity +[index_cache_validity: | default = 5m] - # Openstack Region to use eg LON, ORD - default is use first region (v2,v3 - # auth only) - # CLI flag: -ruler.storage.swift.region-name - [region_name: | default = ""] +# The cache block configures the cache backend. +# The CLI flags prefix for this block configuration is: store.index-cache-read +[index_queries_cache_config: ] - # Name of the Swift container to put chunks in. - # CLI flag: -ruler.storage.swift.container-name - [container_name: | default = "cortex"] +# Disable broad index queries which results in reduced cache usage and faster +# query performance at the expense of somewhat higher QPS on the index store. +# CLI flag: -store.disable-broad-index-queries +[disable_broad_index_queries: | default = false] -# Configures storing index in BoltDB. Required fields only -# required when boltdb is present in the configuration. -boltdb: - # Location of BoltDB index files. - # CLI flag: -boltdb.dir - directory: +# Maximum number of parallel chunk reads. +# CLI flag: -store.max-parallel-get-chunk +[max_parallel_get_chunk: | default = 150] -# Configures storing the chunks on the local file system. Required -# fields only required when filesystem is present in the configuration. -filesystem: - # Directory to store chunks in. - # CLI flag: -local.chunk-directory - directory: +# The maximum number of chunks to fetch per batch. +# CLI flag: -store.max-chunk-batch-size +[max_chunk_batch_size: | default = 50] -# Configures storing index in an Object Store(GCS/S3/Azure/Swift/Filesystem) in the form of -# boltdb files. -# Required fields only required when boltdb-shipper is defined in config. +# Configures storing index in an Object Store (GCS/S3/Azure/Swift/Filesystem) in +# the form of boltdb files. Required fields only required when boltdb-shipper is +# defined in config. boltdb_shipper: - # Directory where ingesters would write boltdb files which would then be + # Directory where ingesters would write index files which would then be # uploaded by shipper to configured storage # CLI flag: -boltdb.shipper.active-index-directory [active_index_directory: | default = ""] - # Shared store for keeping boltdb files. Supported types: gcs, s3, azure, + # Shared store for keeping index files. Supported types: gcs, s3, azure, # filesystem # CLI flag: -boltdb.shipper.shared-store [shared_store: | default = ""] - # Cache location for restoring boltDB files for queries + # Prefix to add to Object Keys in Shared store. Path separator(if any) should + # always be a '/'. Prefix should never start with a separator but should + # always end with it + # CLI flag: -boltdb.shipper.shared-store.key-prefix + [shared_store_key_prefix: | default = "index/"] + + # Cache location for restoring index files from storage for queries # CLI flag: -boltdb.shipper.cache-location [cache_location: | default = ""] - # TTL for boltDB files restored in cache for queries + # TTL for index files restored in cache for queries # CLI flag: -boltdb.shipper.cache-ttl [cache_ttl: | default = 24h] @@ -1776,414 +1877,306 @@ boltdb_shipper: # CLI flag: -boltdb.shipper.resync-interval [resync_interval: | default = 5m] - # Number of days of index to be kept downloaded for queries. Works only with - # tables created with 24h period. + # Number of days of common index to be kept downloaded for queries. For per + # tenant index query readiness, use limits overrides config. # CLI flag: -boltdb.shipper.query-ready-num-days [query_ready_num_days: | default = 0] index_gateway_client: - # "Hostname or IP of the Index Gateway gRPC server. + # The grpc_client block configures the gRPC client used to communicate + # between two Loki components. + # The CLI flags prefix for this block configuration is: + # boltdb.shipper.index-gateway-client.grpc + [grpc_client_config: ] + + # Hostname or IP of the Index Gateway gRPC server running in simple mode. # CLI flag: -boltdb.shipper.index-gateway-client.server-address [server_address: | default = ""] - # Configures the gRPC client used to connect to the Index Gateway gRPC server. - # The CLI flags prefix for this block config is: boltdb.shipper.index-gateway-client - [grpc_client_config: ] - - # Configures if gateway requests should be logged or not. + # Whether requests sent to the gateway should be logged or not. # CLI flag: -boltdb.shipper.index-gateway-client.log-gateway-requests - [log_gateway_requests: | default = false] + [log_gateway_requests: | default = false] -# Cache validity for active index entries. Should be no higher than -# the chunk_idle_period in the ingester settings. -# CLI flag: -store.index-cache-validity -[index_cache_validity: | default = 5m] + # Use boltdb-shipper index store as backup for indexing chunks. When enabled, + # boltdb-shipper needs to be configured under storage_config + # CLI flag: -boltdb.shipper.use-boltdb-shipper-as-backup + [use_boltdb_shipper_as_backup: | default = false] -# Disable broad index queries, which results in reduced cache usage and faster query -# performance at the expense of a somewhat higher QPS on the index store. -# CLI flag: -store.disable-broad-index-queries -[disable_broad_index_queries: | default = false] + [ingestername: | default = ""] -# The maximum number of chunks to fetch per batch. -# CLI flag: -store.max-chunk-batch-size -[max_chunk_batch_size: | default = 50] + [mode: | default = ""] + + [ingesterdbretainperiod: ] + + # Build per tenant index files + # CLI flag: -boltdb.shipper.build-per-tenant-index + [build_per_tenant_index: | default = false] + +tsdb_shipper: + # Directory where ingesters would write index files which would then be + # uploaded by shipper to configured storage + # CLI flag: -tsdb.shipper.active-index-directory + [active_index_directory: | default = ""] + + # Shared store for keeping index files. Supported types: gcs, s3, azure, + # filesystem + # CLI flag: -tsdb.shipper.shared-store + [shared_store: | default = ""] + + # Prefix to add to Object Keys in Shared store. Path separator(if any) should + # always be a '/'. Prefix should never start with a separator but should + # always end with it + # CLI flag: -tsdb.shipper.shared-store.key-prefix + [shared_store_key_prefix: | default = "index/"] + + # Cache location for restoring index files from storage for queries + # CLI flag: -tsdb.shipper.cache-location + [cache_location: | default = ""] + + # TTL for index files restored in cache for queries + # CLI flag: -tsdb.shipper.cache-ttl + [cache_ttl: | default = 24h] -# Config for how the cache for index queries should be built. -# The CLI flags prefix for this block config is: store.index-cache-read -index_queries_cache_config: + # Resync downloaded files with the storage + # CLI flag: -tsdb.shipper.resync-interval + [resync_interval: | default = 5m] + + # Number of days of common index to be kept downloaded for queries. For per + # tenant index query readiness, use limits overrides config. + # CLI flag: -tsdb.shipper.query-ready-num-days + [query_ready_num_days: | default = 0] + + index_gateway_client: + # The grpc_client block configures the gRPC client used to communicate + # between two Loki components. + # The CLI flags prefix for this block configuration is: + # tsdb.shipper.index-gateway-client.grpc + [grpc_client_config: ] + + # Hostname or IP of the Index Gateway gRPC server running in simple mode. + # CLI flag: -tsdb.shipper.index-gateway-client.server-address + [server_address: | default = ""] + + # Whether requests sent to the gateway should be logged or not. + # CLI flag: -tsdb.shipper.index-gateway-client.log-gateway-requests + [log_gateway_requests: | default = false] + + # Use boltdb-shipper index store as backup for indexing chunks. When enabled, + # boltdb-shipper needs to be configured under storage_config + # CLI flag: -tsdb.shipper.use-boltdb-shipper-as-backup + [use_boltdb_shipper_as_backup: | default = false] + + [ingestername: | default = ""] + + [mode: | default = ""] + + [ingesterdbretainperiod: ] ``` -## chunk_store_config +### chunk_store_config -The `chunk_store_config` block configures how chunks will be cached and how long -to wait before saving them to the backing store. +The `chunk_store_config` block configures how chunks will be cached and how long to wait before saving them to the backing store. ```yaml -# The cache configuration for storing chunks -# The CLI flags prefix for this block config is: store.chunks-cache +# The cache block configures the cache backend. +# The CLI flags prefix for this block configuration is: store.chunks-cache [chunk_cache_config: ] -# The cache configuration for deduplicating writes -# The CLI flags prefix for this block config is: store.index-cache-write +# The cache block configures the cache backend. +# The CLI flags prefix for this block configuration is: store.index-cache-write [write_dedupe_cache_config: ] -# Cache index entries older than this period. Default is disabled. +# Cache index entries older than this period. 0 to disable. # CLI flag: -store.cache-lookups-older-than -[cache_lookups_older_than: ] +[cache_lookups_older_than: | default = 0s] -# Limit how long back data can be queried. Default is disabled. -# This should always be set to a value less than or equal to -# what is set in `table_manager.retention_period` . +# This flag is deprecated. Use -querier.max-query-lookback instead. # CLI flag: -store.max-look-back-period -[max_look_back_period: ] +[max_look_back_period: | default = 0s] ``` -## cache_config +### schema_config + +Configures the chunk index schema and where it is stored. + +```yaml +[configs: ] +``` -The `cache_config` block configures how Loki will cache requests, chunks, and -the index to a backing cache store. +### compactor -The memcached configuration variable addresses is experimental. +The `compactor` block configures the compactor component, which compacts index shards for performance. ```yaml -# NOTE: `fifocache` is deprecated. Use `embedded_cache` instead. -# Enable in-memory cache (auto-enabled for the chunks & query results cache if no other cache is configured). -# CLI flag: -.cache.enable-fifocache -[enable_fifocache: ] +# Directory where files can be downloaded for compaction. +# CLI flag: -boltdb.shipper.compactor.working-directory +[working_directory: | default = ""] -# The default validity of entries for caches unless overridden. -# NOTE In Loki versions older than 1.4.0 this was "defaul_validity". -# CLI flag: -.default-validity -[default_validity: ] +# The shared store used for storing boltdb files. Supported types: gcs, s3, +# azure, swift, filesystem, bos. +# CLI flag: -boltdb.shipper.compactor.shared-store +[shared_store: | default = ""] -# Configures embedded cache settings. -embedded_cache: - # Whether embedded cache is enabled. - # CLI flag: -.embedded-cache.enabled - [enabled: | default = false] +# Prefix to add to object keys in shared store. Path separator(if any) should +# always be a '/'. Prefix should never start with a separator but should always +# end with it. +# CLI flag: -boltdb.shipper.compactor.shared-store.key-prefix +[shared_store_key_prefix: | default = "index/"] - # Maximum memory size of the cache in MB. - # CLI flag: -.embedded-cache.max-size-mb - [max_size_mb: | default = 100] +# Interval at which to re-run the compaction operation. +# CLI flag: -boltdb.shipper.compactor.compaction-interval +[compaction_interval: | default = 10m] - # The time to live for items in the cache before they get purged. - # CLI flag: -.embedded-cache.ttl - [ttl: | default = 1hr] +# Interval at which to apply/enforce retention. 0 means run at same interval as +# compaction. If non-zero, it should always be a multiple of compaction +# interval. +# CLI flag: -boltdb.shipper.compactor.apply-retention-interval +[apply_retention_interval: | default = 0s] -# Configures the background cache when memcached is used. -background: - # How many goroutines to use to write back to memcached. - # CLI flag: -.background.write-back-concurrency - [writeback_goroutines: | default = 10] +# (Experimental) Activate custom (per-stream,per-tenant) retention. +# CLI flag: -boltdb.shipper.compactor.retention-enabled +[retention_enabled: | default = false] - # How many chunks to buffer for background write back to memcached. - # CLI flag: -.background.write-back-buffer - [writeback_buffer: = 10000] +# Delay after which chunks will be fully deleted during retention. +# CLI flag: -boltdb.shipper.compactor.retention-delete-delay +[retention_delete_delay: | default = 2h] -# Configures memcached settings. -memcached: - # Configures how long keys stay in memcached. - # CLI flag: -.memcached.expiration - expiration: +# The total amount of worker to use to delete chunks. +# CLI flag: -boltdb.shipper.compactor.retention-delete-worker-count +[retention_delete_worker_count: | default = 150] - # Configures how many keys to fetch in each batch request. - # CLI flag: -.memcached.batchsize - batch_size: | default = 1024 +# The maximum amount of time to spend running retention and deletion on any +# given table in the index. +# CLI flag: -boltdb.shipper.compactor.retention-table-timeout +[retention_table_timeout: | default = 0s] - # Maximum active requests to memcached. - # CLI flag: -.memcached.parallelism - [parallelism: | default = 100] +# The max number of delete requests to run per compaction cycle. +# CLI flag: -boltdb.shipper.compactor.delete-batch-size +[delete_batch_size: | default = 70] -# Configures how to connect to one or more memcached servers. -memcached_client: - # The hostname to use for memcached services when caching chunks. If - # empty, no memcached will be used. A SRV lookup will be used. - # CLI flag: -.memcached.hostname - [host: ] +# Allow cancellation of delete request until duration after they are created. +# Data would be deleted only after delete requests have been older than this +# duration. Ideally this should be set to at least 24h. +# CLI flag: -boltdb.shipper.compactor.delete-request-cancel-period +[delete_request_cancel_period: | default = 24h] - # SRV service used to discover memcached servers. - # CLI flag: -.memcached.service - [service: | default = "memcached"] +# Constrain the size of any single delete request. When a delete request > +# delete_max_interval is input, the request is sharded into smaller requests of +# no more than delete_max_interval +# CLI flag: -boltdb.shipper.compactor.delete-max-interval +[delete_max_interval: | default = 0s] - # (Experimental) Comma-separated addresses list in DNS Service Discovery format: - # https://grafana.com/docs/mimir/latest/operators-guide/configuring/about-dns-service-discovery/ - # CLI flag: -.memcached.addresses - [addresses: | default = ""] +# Maximum number of tables to compact in parallel. While increasing this value, +# please make sure compactor has enough disk space allocated to be able to store +# and compact as many tables. +# CLI flag: -boltdb.shipper.compactor.max-compaction-parallelism +[max_compaction_parallelism: | default = 1] - # Maximum time to wait before giving up on memcached requests. - # CLI flag: -.memcached.timeout - [timeout: | default = 100ms] +# Number of upload/remove operations to execute in parallel when finalizing a +# compaction. NOTE: This setting is per compaction operation, which can be +# executed in parallel. The upper bound on the number of concurrent uploads is +# upload_parallelism * max_compaction_parallelism. +# CLI flag: -boltdb.shipper.compactor.upload-parallelism +[upload_parallelism: | default = 10] - # The maximum number of idle connections in the memcached client pool. - # CLI flag: -.memcached.max-idle-conns - [max_idle_conns: | default = 16] +# The hash ring configuration used by compactors to elect a single instance for +# running compactions. The CLI flags prefix for this block config is: +# boltdb.shipper.compactor.ring +compactor_ring: + kvstore: + # Backend storage to use for the ring. Supported values are: consul, etcd, + # inmemory, memberlist, multi. + # CLI flag: -boltdb.shipper.compactor.ring.store + [store: | default = "consul"] - # The period with which to poll the DNS for memcached servers. - # CLI flag: -.memcached.update-interval - [update_interval: | default = 1m] + # The prefix for the keys in the store. Should end with a /. + # CLI flag: -boltdb.shipper.compactor.ring.prefix + [prefix: | default = "collectors/"] - # Whether or not to use a consistent hash to discover multiple memcached servers. - # CLI flag: -.memcached.consistent-hash - [consistent_hash: | default = true] + # Configuration for a Consul client. Only applies if store is consul. + # The CLI flags prefix for this block configuration is: + # boltdb.shipper.compactor.ring + [consul: ] - # Trip the circuit breaker after this number of consecutive dial failures. - # A value of 0 disables the circuit breaker. - # CLI flag: -.memcached.circuit-breaker-consecutive-failures - [circuit_breaker_consecutive_failures: | default = 10] + # Configuration for an ETCD v3 client. Only applies if store is etcd. + # The CLI flags prefix for this block configuration is: + # boltdb.shipper.compactor.ring + [etcd: ] - # Duration the circuit breaker remains open after tripping. - # If set to 0, the duration is 60 seconds. - # CLI flag: -.memcached.circuit-breaker-timeout - [circuit_breaker_timeout: | default = 10s] + multi: + # Primary backend storage used by multi-client. + # CLI flag: -boltdb.shipper.compactor.ring.multi.primary + [primary: | default = ""] - # Reset the circuit breaker counts after this duration. - # A value of 0 never resets the circuit breaker. - # CLI flag: -.memcached.circuit-breaker-interval - [circuit_breaker_interval: | default = 10s] + # Secondary backend storage used by multi-client. + # CLI flag: -boltdb.shipper.compactor.ring.multi.secondary + [secondary: | default = ""] - # The maximum size of an item stored in memcached. - # Bigger items are not stored. If set to 0, no maximum size is enforced. - # CLI flag: -.memcached.max-item-size - [max_item_size: | default = 0] + # Mirror writes to secondary store. + # CLI flag: -boltdb.shipper.compactor.ring.multi.mirror-enabled + [mirror_enabled: | default = false] -redis: - # Redis Server or Cluster configuration endpoint to use for caching. A comma-separated list of endpoints - # for Redis Cluster or Redis Sentinel. If empty, no redis will be used. - # CLI flag: -.redis.endpoint - [endpoint: ] + # Timeout for storing value to secondary store. + # CLI flag: -boltdb.shipper.compactor.ring.multi.mirror-timeout + [mirror_timeout: | default = 2s] - # Redis Sentinel master name. An empty string for Redis Server or Redis Cluster. - # CLI flag: -.redis.master-name - [master_name: ] + # Period at which to heartbeat to the ring. 0 = disabled. + # CLI flag: -boltdb.shipper.compactor.ring.heartbeat-period + [heartbeat_period: | default = 15s] - # Maximum time to wait before giving up on redis requests. - # CLI flag: -.redis.timeout - [timeout: | default = 500ms] + # The heartbeat timeout after which compactors are considered unhealthy within + # the ring. 0 = never (timeout disabled). + # CLI flag: -boltdb.shipper.compactor.ring.heartbeat-timeout + [heartbeat_timeout: | default = 1m] - # How long keys stay in the redis. - # CLI flag: -.redis.expiration - [expiration: | default = 0s] + # File path where tokens are stored. If empty, tokens are not stored at + # shutdown and restored at startup. + # CLI flag: -boltdb.shipper.compactor.ring.tokens-file-path + [tokens_file_path: | default = ""] - # Database index. - # CLI flag: -.redis.db - [db: | default = 0] + # True to enable zone-awareness and replicate blocks across different + # availability zones. + # CLI flag: -boltdb.shipper.compactor.ring.zone-awareness-enabled + [zone_awareness_enabled: | default = false] - # Maximum number of connections in the pool. - # CLI flag: -.redis.pool-size - [pool_size: | default = 0] + # Instance ID to register in the ring. + # CLI flag: -boltdb.shipper.compactor.ring.instance-id + [instance_id: | default = ""] - # Username to use when connecting to redis. - # CLI flag: -.redis.username - [username: ] + # Name of network interface to read address from. + # CLI flag: -boltdb.shipper.compactor.ring.instance-interface-names + [instance_interface_names: | default = []] - # Password to use when connecting to redis. - # CLI flag: -.redis.password - [password: ] + # Port to advertise in the ring (defaults to server.grpc-listen-port). + # CLI flag: -boltdb.shipper.compactor.ring.instance-port + [instance_port: | default = 0] - # Enables connecting to redis with TLS. - # CLI flag: -.redis.tls-enabled - [tls_enabled: | default = false] + # IP address to advertise in the ring. + # CLI flag: -boltdb.shipper.compactor.ring.instance-addr + [instance_addr: | default = ""] - # Skip validating server certificate. - # CLI flag: -.redis.tls-insecure-skip-verify - [tls_insecure_skip_verify: | default = false] - - # Close connections after remaining idle for this duration. - # If the value is zero, then idle connections are not closed. - # CLI flag: -.redis.idle-timeout - [idle_timeout: | default = 0s] - - # Close connections older than this duration. If the value is zero, then - # the pool does not close connections based on age. - # CLI flag: -.redis.max-connection-age - [max_connection_age: | default = 0s] - -fifocache: - # Maximum memory size of the cache in bytes. A unit suffix (KB, MB, GB) may be - # applied. - # CLI flag: -.fifocache.max-size-bytes - [max_size_bytes: | default = "1GB"] - - # Maximum number of entries in the cache. - # CLI flag: -.fifocache.max-size-items - [max_size_items: | default = 0] - - # Deprecated: The expiry duration for the cache. Use `-.fifocache.ttl`. - # The default value of 0 disables expiration. - # CLI flag: -.fifocache.duration - [validity: ] - - # The time for items to live in the cache before those items are purged. - # The value of 0 disables auto-expiration. - # CLI flag: -.fifocache.ttl - [ttl: | default = 1h] -``` - -## schema_config - -The `schema_config` block configures schemas from given dates. - -```yaml -# The configuration for chunk index schemas. -configs: -- [] -``` - -### period_config - -The `period_config` block configures what index schemas should be used -for from specific time periods. - -```yaml -# The date of the first day that index buckets should be created. Use -# a date in the past if this is your only period_config, otherwise -# use a date when you want the schema to switch over. -# In YYYY-MM-DD format, for example: 2018-04-15. -[from: ] - -# store and object_store below affect which key is -# used. - -# Which store to use for the index. Either aws, aws-dynamo, gcp, bigtable, bigtable-hashed, -# cassandra, boltdb or boltdb-shipper. -store: - -# Which store to use for the chunks. Either aws, azure, gcp, -# bigtable, gcs, cassandra, swift or filesystem. If omitted, defaults to the same -# value as store. -[object_store: ] - -# The schema version to use, current recommended schema is v11. -schema: - -# Configures how the index is updated and stored. -index: - # Table prefix for all period tables. - prefix: - # Table period. - [period: | default = 168h] - # A map to be added to all managed tables. - tags: - [: ...] - -# Configured how the chunks are updated and stored. -chunks: - # Table prefix for all period tables. - prefix: - # Table period. - [period: | default = 168h] - # A map to be added to all managed tables. - tags: - [: ...] - -# How many shards will be created. Only used if schema is v10 or greater. -[row_shards: | default = 16] -``` - -## compactor - -The `compactor` block configures the compactor component. This component periodically -compacts index shards to more performant forms. - -```yaml -# Directory where files can be downloaded for compaction. -# CLI flag: -boltdb.shipper.compactor.working-directory -[working_directory: ] - -# The shared store used for storing boltdb files. -# Supported types: gcs, s3, azure, swift, filesystem, bos. -# CLI flag: -boltdb.shipper.compactor.shared-store -[shared_store: ] - -# Prefix to add to object keys in shared store. -# Path separator(if any) should always be a '/'. -# Prefix should never start with a separator but should always end with it. -# CLI flag: -boltdb.shipper.compactor.shared-store.key-prefix -[shared_store_key_prefix: | default = "index/"] - -# Interval at which to re-run the compaction operation (or retention if enabled). -# CLI flag: -boltdb.shipper.compactor.compaction-interval -[compaction_interval: | default = 10m] - -# Number of upload/remove operations to execute in parallel when finalizing a compaction. -# CLI flag: -boltdb.shipper.compactor.upload-parallelism -# -# NOTE: This setting is per compaction operation, which can be -# executed in parallel. The upper bound on the number of concurrent -# uploads is upload_parallelism * max_compaction_parallelism -[upload_parallelism: | default = 10] - -# (Experimental) Activate custom (per-stream,per-tenant) retention. -# CLI flag: -boltdb.shipper.compactor.retention-enabled -[retention_enabled: | default = false] - -# Delay after which chunks will be fully deleted during retention. -# CLI flag: -boltdb.shipper.compactor.retention-delete-delay -[retention_delete_delay: | default = 2h] - -# The total amount of worker to use to delete chunks. -# CLI flag: -boltdb.shipper.compactor.retention-delete-worker-count -[retention_delete_worker_count: | default = 150] - -# Allow cancellation of delete request until duration after they are created. -# Data would be deleted only after delete requests have been older than this duration. -# Ideally this should be set to at least 24h. -# CLI flag: -boltdb.shipper.compactor.delete-request-cancel-period -[delete_request_cancel_period: | default = 24h] - -# Constrain the size of a delete request. When a delete request that spans > delete_max_interval -# is input, the request is sharded into smaller requests of no more than delete_max_interval. -# -# 0 means no delete_max_interval. -# CLI flag: -boltdb.shipper.compactor.delete-max-interval -[delete_max_interval: | default = 0] - -# The max number of delete requests to run per compaction cycle. -# CLI flag: -boltdb.shipper.compactor.delete-batch-size -[delete_batch_size: | default = 70] - -# The maximum amount of time to spend running retention and deletion -# on any given table in the index. 0 is no timeout -# -# NOTE: This timeout prioritizes runtime over completeness of retention/deletion. -# It may take several compaction runs to fully perform retention and process -# all outstanding delete requests -# CLI flag: -boltdb.shipper.compactor.retention-table-timeout -[retention_table_timeout: | default = 0] - -# Maximum number of tables to compact in parallel. -# While increasing this value, please make sure compactor has enough disk space -# allocated to be able to store and compact as many tables. -# CLI flag: -boltdb.shipper.compactor.max-compaction-parallelism -[max_compaction_parallelism: | default = 1] + # The availability zone where this instance is running. Required if + # zone-awareness is enabled. + # CLI flag: -boltdb.shipper.compactor.ring.instance-availability-zone + [instance_availability_zone: | default = ""] -# Deprecated: Deletion mode. -# Use deletion_mode per tenant configuration instead. -# CLI flag: -boltdb.shipper.compactor.deletion-mode -[deletion_mode: | default = "disabled"] +# Number of tables that compactor will try to compact. Newer tables are chosen +# when this is less than the number of tables available. +# CLI flag: -boltdb.shipper.compactor.tables-to-compact +[tables_to_compact: | default = 0] -# The hash ring configuration used by compactors to elect a single instance for running compactions -# The CLI flags prefix for this block config is: boltdb.shipper.compactor.ring -[compactor_ring: ] - -# Number of tables that compactor will try to compact. Newer tables -# are chosen when this is less than the number of tables available -# CLI flag: -boltdb.shipper.compact.tables-to-compact -[tables_to_compact: | default: 0] - -# Do not compact N latest tables. Together with +# Do not compact N latest tables. Together with # -boltdb.shipper.compactor.run-once and -# -boltdb.shipper.compactor.tables-to-compact, this is useful when -# clearing compactor backlogs. -# CLI flag: -boltdb.shipper.compact.skip-latest-n-tables -[skip_latest_n_tables: | default: 0] - -# The hash ring configuration used by compactors to elect a single instance for running compactions -# The CLI flags prefix for this block config is: boltdb.shipper.compactor.ring -[compactor_ring: ] +# -boltdb.shipper.compactor.tables-to-compact, this is useful when clearing +# compactor backlogs. +# CLI flag: -boltdb.shipper.compactor.skip-latest-n-tables +[skip_latest_n_tables: | default = 0] + +# Deprecated: Use deletion_mode per tenant configuration instead. +[deletion_mode: | default = ""] ``` -## limits_config +### limits_config The `limits_config` block configures global and per-tenant limits in Loki. @@ -2191,15 +2184,14 @@ The `limits_config` block configures global and per-tenant limits in Loki. # Whether the ingestion rate limit should be applied individually to each # distributor instance (local), or evenly shared across the cluster (global). # The ingestion rate strategy cannot be overridden on a per-tenant basis. -# # - local: enforces the limit on a per distributor basis. The actual effective -# rate limit will be N times higher, where N is the number of distributor -# replicas. +# rate limit will be N times higher, where N is the number of distributor +# replicas. # - global: enforces the limit globally, configuring a per-distributor local -# rate limiter as "ingestion_rate / N", where N is the number of distributor -# replicas (it's automatically adjusted if the number of replicas change). -# The global strategy requires the distributors to form their own ring, which -# is used to keep track of the current number of healthy distributor replicas. +# rate limiter as 'ingestion_rate / N', where N is the number of distributor +# replicas (it's automatically adjusted if the number of replicas change). The +# global strategy requires the distributors to form their own ring, which is +# used to keep track of the current number of healthy distributor replicas. # CLI flag: -distributor.ingestion-rate-limit-strategy [ingestion_rate_strategy: | default = "global"] @@ -2207,18 +2199,19 @@ The `limits_config` block configures global and per-tenant limits in Loki. # CLI flag: -distributor.ingestion-rate-limit-mb [ingestion_rate_mb: | default = 4] -# Per-user allowed ingestion burst size (in sample size). Units in MB. -# The burst size refers to the per-distributor local rate limiter even in the -# case of the "global" strategy, and should be set at least to the maximum logs -# size expected in a single push request. +# Per-user allowed ingestion burst size (in sample size). Units in MB. The burst +# size refers to the per-distributor local rate limiter even in the case of the +# 'global' strategy, and should be set at least to the maximum logs size +# expected in a single push request. # CLI flag: -distributor.ingestion-burst-size-mb -[ingestion_burst_size_mb: | default = 6] +[ingestion_burst_size_mb: | default = 6] -# Maximum length of a label name. +# Maximum length accepted for label names. # CLI flag: -validation.max-length-label-name [max_label_name_length: | default = 1024] -# Maximum length of a label value. +# Maximum length accepted for label value. This setting also applies to the +# metric name. # CLI flag: -validation.max-length-label-value [max_label_value_length: | default = 2048] @@ -2232,10 +2225,10 @@ The `limits_config` block configures global and per-tenant limits in Loki. # Maximum accepted sample age before rejecting. # CLI flag: -validation.reject-old-samples.max-age -[reject_old_samples_max_age: | default = 168h] +[reject_old_samples_max_age: | default = 1w] -# Duration for a table to be created/deleted before/after it's -# needed. Samples won't be accepted before this time. +# Duration which table will be created/deleted before/after it's needed; we +# won't accept sample from before this time. # CLI flag: -validation.create-grace-period [creation_grace_period: | default = 10m] @@ -2243,33 +2236,30 @@ The `limits_config` block configures global and per-tenant limits in Loki. # CLI flag: -validation.enforce-metric-name [enforce_metric_name: | default = true] -# Maximum line size on ingestion path. Example: 256kb. -# There is no limit when unset or set to 0. +# Maximum line size on ingestion path. Example: 256kb. There is no limit when +# unset or set to 0. # CLI flag: -distributor.max-line-size -[max_line_size: | default = 0 ] +[max_line_size: | default = 0B] -# Truncate log lines when they exceed max_line_size. +# Whether to truncate lines that exceed max_line_size. # CLI flag: -distributor.max-line-size-truncate -[max_line_size_truncate: | default = false ] - -# Alter the log line timestamp during ingestion when the timestamp is the same as the -# previous entry for the same stream. When enabled, if a log line in a push request has -# the same timestamp as the previous line for the same stream, one nanosecond is added -# to the log line. This will preserve the received order of log lines with the exact -# same timestamp when they are queried, by slightly altering their stored timestamp. -# NOTE: This is imperfect, because Loki accepts out of order writes, and another push -# request for the same stream could contain duplicate timestamps to existing -# entries and they will not be incremented. +[max_line_size_truncate: | default = false] + +# Alter the log line timestamp during ingestion when the timestamp is the same +# as the previous entry for the same stream. When enabled, if a log line in a +# push request has the same timestamp as the previous line for the same stream, +# one nanosecond is added to the log line. This will preserve the received order +# of log lines with the exact same timestamp when they are queried, by slightly +# altering their stored timestamp. NOTE: This is imperfect, because Loki accepts +# out of order writes, and another push request for the same stream could +# contain duplicate timestamps to existing entries and they will not be +# incremented. # CLI flag: -validation.increment-duplicate-timestamps -[increment_duplicate_timestamp: | default = false ] +[increment_duplicate_timestamp: | default = false] -# Maximum number of log entries that will be returned for a query. -# CLI flag: -validation.max-entries-limit -[max_entries_limit_per_query: | default = 5000 ] - -# Maximum number of active streams per user, per ingester. 0 to make it unlimited. +# Maximum number of active streams per user, per ingester. 0 to disable. # CLI flag: -ingester.max-streams-per-user -[max_streams_per_user: | default 0] +[max_streams_per_user: | default = 0] # Maximum number of active streams per user, across the cluster. 0 to disable. # When the global limit is enabled, each ingester is configured with a dynamic @@ -2282,22 +2272,46 @@ The `limits_config` block configures global and per-tenant limits in Loki. # CLI flag: -ingester.unordered-writes [unordered_writes: | default = true] -# Maximum number of chunks that can be fetched by a single query. +# Maximum byte rate per second per stream, also expressible in human readable +# forms (1MB, 256KB, etc). +# CLI flag: -ingester.per-stream-rate-limit +[per_stream_rate_limit: | default = 3MB] + +# Maximum burst bytes per stream, also expressible in human readable forms (1MB, +# 256KB, etc). This is how far above the rate limit a stream can 'burst' before +# the stream is limited. +# CLI flag: -ingester.per-stream-rate-limit-burst +[per_stream_rate_limit_burst: | default = 15MB] + +# Maximum number of chunks that can be fetched in a single query. # CLI flag: -store.query-chunk-limit [max_chunks_per_query: | default = 2000000] +# Limit the maximum of unique series that is returned by a metric query. When +# the limit is reached an error is returned. +# CLI flag: -querier.max-query-series +[max_query_series: | default = 500] + +# Limit how far back in time series data and metadata can be queried, up until +# lookback duration ago. This limit is enforced in the query frontend, the +# querier and the ruler. If the requested time range is outside the allowed +# range, the request will not fail, but will be modified to only query data +# within the allowed time range. The default value of 0 does not set a limit. +# CLI flag: -querier.max-query-lookback +[max_query_lookback: | default = 0s] + # The limit to length of chunk store queries. 0 to disable. # CLI flag: -store.max-query-length -[max_query_length: | default = 721h] +[max_query_length: | default = 30d1h] # Maximum number of queries that will be scheduled in parallel by the frontend. # CLI flag: -querier.max-query-parallelism [max_query_parallelism: | default = 32] -# Limit the maximum of unique series that is returned by a metric query. -# When the limit is reached an error is returned. -# CLI flag: -querier.max-query-series -[max_query_series: | default = 500] +# Maximum number of queries will be scheduled in parallel by the frontend for +# TSDB schemas. +# CLI flag: -querier.tsdb-max-query-parallelism +[tsdb_max_query_parallelism: | default = 512] # Cardinality limit for index queries. # CLI flag: -store.cardinality-limit @@ -2311,51 +2325,12 @@ The `limits_config` block configures global and per-tenant limits in Loki. # CLI flag: -querier.max-concurrent-tail-requests [max_concurrent_tail_requests: | default = 10] -# Duration to delay the evaluation of rules to ensure. -# CLI flag: -ruler.evaluation-delay-duration -[ruler_evaluation_delay_duration: | default = 0s] - -# Maximum number of rules per rule group per-tenant. 0 to disable. -# CLI flag: -ruler.max-rules-per-rule-group -[ruler_max_rules_per_rule_group: | default = 0] - -# Maximum number of rule groups per-tenant. 0 to disable. -# CLI flag: -ruler.max-rule-groups-per-tenant -[ruler_max_rule_groups_per_tenant: | default = 0] - -# Ruler alertmanager configuration per tenant. -[ruler_alertmanager_config: ] - -# Retention to apply for the store, if the retention is enable on the compactor side. -# CLI flag: -store.retention -[retention_period: | default = 744h] - -# Per-stream retention to apply, if the retention is enable on the compactor side. -# Example: -# retention_stream: -# - selector: '{namespace="dev"}' -# priority: 1 -# period: 24h -# - selector: '{container="nginx"}' -# priority: 1 -# period: 744h -# Selector is a Prometheus labels matchers that will apply the `period` retention only if -# the stream is matching. In case multiple stream are matching, the highest -# priority will be picked. If no rule is matched the `retention_period` is used. -[retention_stream: | default = none] - -# Feature renamed to 'runtime configuration', flag deprecated in favor of -runtime-config.file -# (runtime_config.file in YAML). -# CLI flag: -limits.per-user-override-config -[per_tenant_override_config: ] - -# Feature renamed to 'runtime configuration'; flag deprecated in favor of -# -runtime-config.reload-period (runtime_config.period in YAML). -# CLI flag: -limits.per-user-override-period -[per_tenant_override_period: | default = 10s] +# Maximum number of log entries that will be returned for a query. +# CLI flag: -validation.max-entries-limit +[max_entries_limit_per_query: | default = 5000] -# Most recent allowed cacheable result per-tenant, to prevent caching very recent results that -# might still be in flux. +# Most recent allowed cacheable result per-tenant, to prevent caching very +# recent results that might still be in flux. # CLI flag: -frontend.max-cache-freshness [max_cache_freshness_per_query: | default = 1m] @@ -2369,775 +2344,1680 @@ The `limits_config` block configures global and per-tenant limits in Loki. # CLI flag: -frontend.max-queriers-per-tenant [max_queriers_per_tenant: | default = 0] -# Maximum byte rate per second per stream, -# also expressible in human readable forms (1MB, 256KB, etc). -# CLI flag: -ingester.per-stream-rate-limit -[per_stream_rate_limit: | default = "3MB"] +# Number of days of index to be kept always downloaded for queries. Applies only +# to per user index in boltdb-shipper index store. 0 to disable. +# CLI flag: -store.query-ready-index-num-days +[query_ready_index_num_days: | default = 0] -# Maximum burst bytes per stream, -# also expressible in human readable forms (1MB, 256KB, etc). -# This is how far above the rate limit a stream can "burst" before the stream is limited. -# CLI flag: -ingester.per-stream-rate-limit-burst -[per_stream_rate_limit_burst: | default = "15MB"] +# Timeout when querying backends (ingesters or storage) during the execution of +# a query request. If a specific per-tenant timeout is used, this timeout is +# ignored. +# CLI flag: -querier.query-timeout +[query_timeout: | default = 1m] -# Configures the distributor to shard streams that are too big -shard_streams: - # Whether to enable stream sharding - # - # CLI flag: -shard-streams.enabled - [enabled: | default = false] +# Split queries by a time interval and execute in parallel. The value 0 disables +# splitting by time. This also determines how cache keys are chosen when result +# caching is enabled. +# CLI flag: -querier.split-queries-by-interval +[split_queries_by_interval: | default = 30m] - # Enable logging when sharding streams because logging on the read path may - # impact performance. When disabled, stream sharding will emit no logs - # regardless of log level - # - # CLI flag: -shard-streams.logging-enabled - [logging_enabled: | default = false] - - # Threshold that determines how much the stream should be sharded. - # The formula used is n = ceil(stream size + ingested rate / desired rate), where n is the number of shards. - # For instance, if a stream ingestion is at 10MB, desired rate is 3MB (default), and a stream of size 1MB is - # received, the given stream will be split into n = ceil((1 + 10)/3) = 4 shards. - # - # CLI flag: -shard-streams.desired-rate - [desired_rate: | default = 3MB] - -# Limit how far back in time series data and metadata can be queried, -# up until lookback duration ago. -# This limit is enforced in the query frontend, the querier and the ruler. -# If the requested time range is outside the allowed range, the request will not fail, -# but will be modified to only query data within the allowed time range. -# The default value of 0 does not set a limit. -# CLI flag: -querier.max-query-lookback -[max_query_lookback: | default = 0] +# Limit queries that can be sharded. Queries within the time range of now and +# now minus this sharding lookback are not sharded. The default value of 0s +# disables the lookback, causing sharding of all queries at all times. +# CLI flag: -frontend.min-sharding-lookback +[min_sharding_lookback: | default = 0s] + +# Duration to delay the evaluation of rules to ensure the underlying metrics +# have been pushed to Cortex. +# CLI flag: -ruler.evaluation-delay-duration +[ruler_evaluation_delay_duration: | default = 0s] + +# Maximum number of rules per rule group per-tenant. 0 to disable. +# CLI flag: -ruler.max-rules-per-rule-group +[ruler_max_rules_per_rule_group: | default = 0] + +# Maximum number of rule groups per-tenant. 0 to disable. +# CLI flag: -ruler.max-rule-groups-per-tenant +[ruler_max_rule_groups_per_tenant: | default = 0] # Disable recording rules remote-write. -[ruler_remote_write_disabled: | default = false] +[ruler_remote_write_disabled: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# The URL of the endpoint to send samples to. -[ruler_remote_write_url: ] +# Deprecated: Use 'ruler_remote_write_config' instead. The URL of the endpoint +# to send samples to. +[ruler_remote_write_url: | default = ""] -# Deprecated: Use `ruler_remote_write_config` instead. -# Timeout for requests to the remote write endpoint. +# Deprecated: Use 'ruler_remote_write_config' instead. Timeout for requests to +# the remote write endpoint. [ruler_remote_write_timeout: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# Custom HTTP headers to be sent along with each remote write request. -# Be aware that headers that are set by Loki itself can't be overwritten. +# Deprecated: Use 'ruler_remote_write_config' instead. Custom HTTP headers to be +# sent along with each remote write request. Be aware that headers that are set +# by Loki itself can't be overwritten. [ruler_remote_write_headers: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# List of remote write relabel configurations. -[ruler_remote_write_relabel_configs: ] +# Deprecated: Use 'ruler_remote_write_config' instead. List of remote write +# relabel configurations. +[ruler_remote_write_relabel_configs: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# Number of samples to buffer per shard before we block reading of more -# samples from the WAL. It is recommended to have enough capacity in each -# shard to buffer several requests to keep throughput up while processing -# occasional slow remote requests. +# Deprecated: Use 'ruler_remote_write_config' instead. Number of samples to +# buffer per shard before we block reading of more samples from the WAL. It is +# recommended to have enough capacity in each shard to buffer several requests +# to keep throughput up while processing occasional slow remote requests. [ruler_remote_write_queue_capacity: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# Minimum number of shards, i.e. amount of concurrency. +# Deprecated: Use 'ruler_remote_write_config' instead. Minimum number of shards, +# i.e. amount of concurrency. [ruler_remote_write_queue_min_shards: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# Maximum number of shards, i.e. amount of concurrency. +# Deprecated: Use 'ruler_remote_write_config' instead. Maximum number of shards, +# i.e. amount of concurrency. [ruler_remote_write_queue_max_shards: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# Maximum number of samples per send. +# Deprecated: Use 'ruler_remote_write_config' instead. Maximum number of samples +# per send. [ruler_remote_write_queue_max_samples_per_send: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# Maximum time a sample will wait in buffer. +# Deprecated: Use 'ruler_remote_write_config' instead. Maximum time a sample +# will wait in buffer. [ruler_remote_write_queue_batch_send_deadline: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# Initial retry delay. Gets doubled for every retry. +# Deprecated: Use 'ruler_remote_write_config' instead. Initial retry delay. Gets +# doubled for every retry. [ruler_remote_write_queue_min_backoff: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# Maximum retry delay. +# Deprecated: Use 'ruler_remote_write_config' instead. Maximum retry delay. [ruler_remote_write_queue_max_backoff: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# Retry upon receiving a 429 status code from the remote-write storage. -# This is experimental and might change in the future. +# Deprecated: Use 'ruler_remote_write_config' instead. Retry upon receiving a +# 429 status code from the remote-write storage. This is experimental and might +# change in the future. [ruler_remote_write_queue_retry_on_ratelimit: ] -# Deprecated: Use `ruler_remote_write_config` instead. -# Configures AWS's Signature Verification 4 signing process to -# sign every remote write request. -[ruler_remote_write_sigv4_config: ] - -# Configures global and per-tenant limits for remote write clients. -# A map with remote client id as key. -ruler_remote_write_config: - [: ] - -# Limit queries that can be sharded. -# Queries within the time range of now and now minus this sharding lookback -# are not sharded. The default value of 0s disables the lookback, causing -# sharding of all queries at all times. -# CLI flag: -frontend.min-sharding-lookback -[min_sharding_lookback: | default = 0s] - -# Split queries by a time interval and execute in parallel. The value 0 disables splitting by time. -# This also determines how cache keys are chosen when result caching is enabled -# CLI flag: -querier.split-queries-by-interval -[split_queries_by_interval: | default = 30m] - -# Deprecated: Use deletion_mode per tenant configuration instead. -# CLI flag: -compactor.allow_deletes -[allow_deletes: | default = false] - -# Deletion mode. -# Can be one of "disabled", "filter-only", or "filter-and-delete". -# When set to "filter-only" or "filter-and-delete", and if -# retention_enabled is true, then the log entry deletion API endpoints are available. -# CLI flag: -boltdb.shipper.compactor.deletion-mode -[deletion_mode: | default = "filter-and-delete"] -``` - -## sigv4_config - -The `sigv4_config` block configures AWS's Signature Verification 4 signing process to -sign every remote write request. - -```yaml -# The AWS region. If blank, the region from the default credentials chain -# is used. -[region: ] - -# The AWS API keys. If blank, the environment variables `AWS_ACCESS_KEY_ID` -# and `AWS_SECRET_ACCESS_KEY` are used. -[access_key: ] -[secret_key: ] - -# Named AWS profile used to authenticate. -[profile: ] - -# AWS Role ARN, an alternative to using AWS API keys. -[role_arn: ] -``` +# Deprecated: Use 'ruler_remote_write_config' instead. Configures AWS's +# Signature Verification 4 signing process to sign every remote write request. +ruler_remote_write_sigv4_config: + [region: | default = ""] -## alertmanager_config + [access_key: | default = ""] -The `alertmanager_config` block configures the alertmanager for the ruler alerts. + [secret_key: | default = ""] -```yaml -# Comma-separated list of Alertmanager URLs to send notifications to. -# Each Alertmanager URL is treated as a separate group in the configuration. -# Multiple Alertmanagers in HA per group can be supported by using DNS -# resolution via -ruler.alertmanager-discovery. -[alertmanager_url: | default = ""] + [profile: | default = ""] + [role_arn: | default = ""] -alertmanager_client: - # Sets the `Authorization` header on every remote write request with the - # configured username and password. - # password and password_file are mutually exclusive. - [basic_auth_username: ] - [basic_auth_password: ] - - # Optional `Authorization` header configuration. - authorization: - # Sets the authentication type. - [type: | default: Bearer] - # Sets the credentials. It is mutually exclusive with - # `credentials_file`. - [credentials: ] - # Sets the credentials to the credentials read from the configured file. - # It is mutually exclusive with `credentials`. - [credentials_file: ] +# Configures global and per-tenant limits for remote write clients. A map with +# remote client id as key. +[ruler_remote_write_config: ] -# Use DNS SRV records to discover Alertmanager hosts. -[enable_alertmanager_discovery: | default = false] +# Deletion mode. Can be one of 'disabled', 'filter-only', or +# 'filter-and-delete'. When set to 'filter-only' or 'filter-and-delete', and if +# retention_enabled is true, then the log entry deletion API endpoints are +# available. +# CLI flag: -compactor.deletion-mode +[deletion_mode: | default = "filter-and-delete"] -# How long to wait between refreshing DNS resolutions of Alertmanager hosts. -[alertmanager_refresh_interval: | default = 1m] +# Retention to apply for the store, if the retention is enabled on the compactor +# side. +# CLI flag: -store.retention +[retention_period: | default = 31d] -# If enabled, then requests to Alertmanager use the v2 API. -[enable_alertmanager_v2: | default = false] +# Per-stream retention to apply, if the retention is enable on the compactor +# side. +# Example: +# retention_stream: +# - selector: '{namespace="dev"}' +# priority: 1 +# period: 24h +# - selector: '{container="nginx"}' +# priority: 1 +# period: 744h +# Selector is a Prometheus labels matchers that will apply the 'period' +# retention only if the stream is matching. In case multiple stream are +# matching, the highest priority will be picked. If no rule is matched the +# 'retention_period' is used. +[retention_stream: ] + +# Feature renamed to 'runtime configuration', flag deprecated in favor of +# -runtime-config.file (runtime_config.file in YAML). +# CLI flag: -limits.per-user-override-config +[per_tenant_override_config: | default = ""] -# List of alert relabel configs -alert_relabel_configs: - [- ...] +# Feature renamed to 'runtime configuration'; flag deprecated in favor of +# -runtime-config.reload-period (runtime_config.period in YAML). +# CLI flag: -limits.per-user-override-period +[per_tenant_override_period: | default = 10s] -# Capacity of the queue for notifications to be sent to the Alertmanager. -[notification_queue_capacity: | default = 10000] +# Deprecated: Use deletion_mode per tenant configuration instead. +[allow_deletes: ] -# HTTP timeout duration when sending notifications to the Alertmanager. -[notification_timeout: | default = 10s] -``` +shard_streams: + [enabled: ] -## remote_write_client_config + [logging_enabled: ] -The `remote_write_client_config` block configures the client for the remote write function in the ruler. + [desired_rate: ] -```yaml -# The URL of the endpoint to send samples to. -url: - -# Timeout for requests to the remote write endpoint. -[remote_timeout: | default = 30s] - -# Custom HTTP headers to be sent along with each remote write request. -# Be aware that headers that are set by Loki itself can't be overwritten. -headers: - [: ...] - -# List of remote write relabel configurations. -write_relabel_configs: - [- ...] - -# Name of the remote write config, which if specified must be unique among remote -# write configs. -# The name will be used in metrics and logging in place of a generated value -# to help users distinguish between remote write configs. -[name: ] - -# Sets the `Authorization` header on every remote write request with the -# configured username and password. -# password and password_file are mutually exclusive. -basic_auth: - [username: ] - [password: ] - [password_file: ] - -# Optional `Authorization` header configuration. -authorization: - # Sets the authentication type. - [type: | default: Bearer] - # Sets the credentials. It is mutually exclusive with - # `credentials_file`. - [credentials: ] - # Sets the credentials to the credentials read from the configured file. - # It is mutually exclusive with `credentials`. - [credentials_file: ] - -# Optionally configures AWS's Signature Verification 4 signing process to -# sign requests. Cannot be set at the same time as basic_auth, authorization, or oauth2. -# To use the default credentials from the AWS SDK, use `sigv4: {}`. -[sigv4: ] - -# Configures the remote write request's TLS settings. -tls_config: - # CA certificate to validate API server certificate with. - [ca_file: ] - # Certificate and key files for client cert authentication to the server. - [cert_file: ] - [key_file: ] - # ServerName extension to indicate the name of the server. - # https://tools.ietf.org/html/rfc4366#section-3.1 - [server_name: ] - # Disable validation of the server certificate. - [insecure_skip_verify: ] - -# Optional proxy URL. -[proxy_url: ] - -# Configure whether HTTP requests follow HTTP 3xx redirects. -[follow_redirects: | default = true] - -# Configures the queue used to write to remote storage. -queue_config: - # Number of samples to buffer per shard before we block reading of more - # samples from the WAL. It is recommended to have enough capacity in each - # shard to buffer several requests to keep throughput up while processing - # occasional slow remote requests. - [capacity: | default = 2500] - # Maximum number of shards, i.e. amount of concurrency. - [max_shards: | default = 200] - # Minimum number of shards, i.e. amount of concurrency. - [min_shards: | default = 1] - # Maximum number of samples per send. - [max_samples_per_send: | default = 500] - # Maximum time a sample will wait in buffer. - [batch_send_deadline: | default = 5s] - # Initial retry delay. Gets doubled for every retry. - [min_backoff: | default = 30ms] - # Maximum retry delay. - [max_backoff: | default = 100ms] - # Retry upon receiving a 429 status code from the remote-write storage. - # This is experimental and might change in the future. - [retry_on_http_429: | default = false] +[blocked_queries: ] ``` -### grpc_client_config +### frontend_worker -The `grpc_client_config` block configures a client connection to a gRPC service. +The `frontend_worker` configures the worker - running within the Loki querier - picking up and executing queries enqueued by the query-frontend. ```yaml -# The maximum size in bytes the client can receive. -# CLI flag: -.grpc-max-recv-msg-size -[max_recv_msg_size: | default = 104857600] - -# The maximum size in bytes the client can send. -# CLI flag: -.grpc-max-send-msg-size -[max_send_msg_size: | default = 16777216] - -# Use compression when sending messages. Supported values are: 'gzip', 'snappy', -# and '' (disable compression). -# CLI flag: -.grpc-compression -[grpc_compression: | default = ''] - -# Rate limit for gRPC client. 0 is disabled. -# CLI flag: -.grpc-client-rate-limit -[rate_limit: | default = 0] - -# Rate limit burst for gRPC client. -# CLI flag: -.grpc-client-rate-limit-burst -[rate_limit_burst: | default = 0] - -# Enable backoff and retry when a rate limit is hit. -# CLI flag: -.backoff-on-ratelimits -[backoff_on_ratelimits: | default = false] +# Address of query frontend service, in host:port format. If +# -querier.scheduler-address is set as well, querier will use scheduler instead. +# Only one of -querier.frontend-address or -querier.scheduler-address can be +# set. If neither is set, queries are only received via HTTP endpoint. +# CLI flag: -querier.frontend-address +[frontend_address: | default = ""] -# Configures backoff when enabled. -backoff_config: - # Minimum delay when backing off. - # CLI flag: -.backoff-min-period - [min_period: | default = 100ms] +# Hostname (and port) of scheduler that querier will periodically resolve, +# connect to and receive queries from. Only one of -querier.frontend-address or +# -querier.scheduler-address can be set. If neither is set, queries are only +# received via HTTP endpoint. +# CLI flag: -querier.scheduler-address +[scheduler_address: | default = ""] - # The maximum delay when backing off. - # CLI flag: -.backoff-max-period - [max_period: | default = 10s] +# How often to query DNS for query-frontend or query-scheduler address. Also +# used to determine how often to poll the scheduler-ring for addresses if the +# scheduler-ring is configured. +# CLI flag: -querier.dns-lookup-period +[dns_lookup_duration: | default = 3s] - # Number of times to backoff and retry before failing. - # CLI flag: -.backoff-retries - [max_retries: | default = 10] -``` +# Number of simultaneous queries to process per query-frontend or +# query-scheduler. +# CLI flag: -querier.worker-parallelism +[parallelism: | default = 10] -## index_gateway +# Force worker concurrency to match the -querier.max-concurrent option. +# Overrides querier.worker-parallelism. +# CLI flag: -querier.worker-match-max-concurrent +[match_max_concurrent: | default = true] -The `index_gateway` block configures the Loki index gateway server, responsible for serving index queries -without the need to constantly interact with the object store. +# Querier ID, sent to frontend service to identify requests from the same +# querier. Defaults to hostname. +# CLI flag: -querier.id +[id: | default = ""] -```yaml -# Defines in which mode the index gateway server will operate (default to 'simple'). -# It supports two modes: -# 'simple': an index gateway server instance is responsible for handling, -# storing and returning requests for all indices for all tenants. -# 'ring': an index gateway server instance is responsible for a subset of tenants instead -# of all tenants. -[mode: | default = simple] - -# Defines the ring to be used by the index gateway servers and clients in case the servers -# are configured to run in 'ring' mode. In case this isn't configured, this block supports -# inheriting configuration from the common ring section. -[ring: ] +# The grpc_client block configures the gRPC client used to communicate between +# two Loki components. +# The CLI flags prefix for this block configuration is: querier.frontend-client +[grpc_client_config: ] ``` -## table_manager +### table_manager -The `table_manager` block configures the Loki table-manager. +The `table_manager` block configures the table manager for retention. ```yaml -# Master 'off-switch' for table capacity updates, e.g. when troubleshooting. +# If true, disable all changes to DB capacity # CLI flag: -table-manager.throughput-updates-disabled [throughput_updates_disabled: | default = false] -# Master 'on-switch' for table retention deletions. +# If true, enables retention deletes of DB tables # CLI flag: -table-manager.retention-deletes-enabled [retention_deletes_enabled: | default = false] -# How far back tables will be kept before they are deleted. 0s disables -# deletion. The retention period must be a multiple of the index / chunks -# table "period" (see period_config). +# Tables older than this retention period are deleted. Must be either 0 +# (disabled) or a multiple of 24h. When enabled, be aware this setting is +# destructive to data! # CLI flag: -table-manager.retention-period [retention_period: | default = 0s] -# Period with which the table manager will poll for tables. +# How frequently to poll backend to learn our capacity. # CLI flag: -table-manager.poll-interval [poll_interval: | default = 2m] -# Duration a table will be created before it is needed. +# Periodic tables grace period (duration which table will be created/deleted +# before/after it's needed). # CLI flag: -table-manager.periodic-table.grace-period [creation_grace_period: | default = 10m] -# Configures management of the index tables for DynamoDB. -# The CLI flags prefix for this block config is: table-manager.index-table -index_tables_provisioning: - -# Configures management of the chunk tables for DynamoDB. -# The CLI flags prefix for this block config is: table-manager.chunk-table -chunk_tables_provisioning: +index_tables_provisioning: + # Enables on demand throughput provisioning for the storage provider (if + # supported). Applies only to tables which are not autoscaled. Supported by + # DynamoDB + # CLI flag: -table-manager.index-table.enable-ondemand-throughput-mode + [enable_ondemand_throughput_mode: | default = false] + + # Table default write throughput. Supported by DynamoDB + # CLI flag: -table-manager.index-table.write-throughput + [provisioned_write_throughput: | default = 1000] + + # Table default read throughput. Supported by DynamoDB + # CLI flag: -table-manager.index-table.read-throughput + [provisioned_read_throughput: | default = 300] + + write_scale: + # Should we enable autoscale for the table. + # CLI flag: -table-manager.index-table.write-throughput.scale.enabled + [enabled: | default = false] + + # AWS AutoScaling role ARN + # CLI flag: -table-manager.index-table.write-throughput.scale.role-arn + [role_arn: | default = ""] + + # DynamoDB minimum provision capacity. + # CLI flag: -table-manager.index-table.write-throughput.scale.min-capacity + [min_capacity: | default = 3000] + + # DynamoDB maximum provision capacity. + # CLI flag: -table-manager.index-table.write-throughput.scale.max-capacity + [max_capacity: | default = 6000] + + # DynamoDB minimum seconds between each autoscale up. + # CLI flag: -table-manager.index-table.write-throughput.scale.out-cooldown + [out_cooldown: | default = 1800] + + # DynamoDB minimum seconds between each autoscale down. + # CLI flag: -table-manager.index-table.write-throughput.scale.in-cooldown + [in_cooldown: | default = 1800] + + # DynamoDB target ratio of consumed capacity to provisioned capacity. + # CLI flag: -table-manager.index-table.write-throughput.scale.target-value + [target: | default = 80] + + read_scale: + # Should we enable autoscale for the table. + # CLI flag: -table-manager.index-table.read-throughput.scale.enabled + [enabled: | default = false] + + # AWS AutoScaling role ARN + # CLI flag: -table-manager.index-table.read-throughput.scale.role-arn + [role_arn: | default = ""] + + # DynamoDB minimum provision capacity. + # CLI flag: -table-manager.index-table.read-throughput.scale.min-capacity + [min_capacity: | default = 3000] + + # DynamoDB maximum provision capacity. + # CLI flag: -table-manager.index-table.read-throughput.scale.max-capacity + [max_capacity: | default = 6000] + + # DynamoDB minimum seconds between each autoscale up. + # CLI flag: -table-manager.index-table.read-throughput.scale.out-cooldown + [out_cooldown: | default = 1800] + + # DynamoDB minimum seconds between each autoscale down. + # CLI flag: -table-manager.index-table.read-throughput.scale.in-cooldown + [in_cooldown: | default = 1800] + + # DynamoDB target ratio of consumed capacity to provisioned capacity. + # CLI flag: -table-manager.index-table.read-throughput.scale.target-value + [target: | default = 80] + + # Enables on demand throughput provisioning for the storage provider (if + # supported). Applies only to tables which are not autoscaled. Supported by + # DynamoDB + # CLI flag: -table-manager.index-table.inactive-enable-ondemand-throughput-mode + [enable_inactive_throughput_on_demand_mode: | default = false] + + # Table write throughput for inactive tables. Supported by DynamoDB + # CLI flag: -table-manager.index-table.inactive-write-throughput + [inactive_write_throughput: | default = 1] + + # Table read throughput for inactive tables. Supported by DynamoDB + # CLI flag: -table-manager.index-table.inactive-read-throughput + [inactive_read_throughput: | default = 300] + + inactive_write_scale: + # Should we enable autoscale for the table. + # CLI flag: -table-manager.index-table.inactive-write-throughput.scale.enabled + [enabled: | default = false] + + # AWS AutoScaling role ARN + # CLI flag: -table-manager.index-table.inactive-write-throughput.scale.role-arn + [role_arn: | default = ""] + + # DynamoDB minimum provision capacity. + # CLI flag: -table-manager.index-table.inactive-write-throughput.scale.min-capacity + [min_capacity: | default = 3000] + + # DynamoDB maximum provision capacity. + # CLI flag: -table-manager.index-table.inactive-write-throughput.scale.max-capacity + [max_capacity: | default = 6000] + + # DynamoDB minimum seconds between each autoscale up. + # CLI flag: -table-manager.index-table.inactive-write-throughput.scale.out-cooldown + [out_cooldown: | default = 1800] + + # DynamoDB minimum seconds between each autoscale down. + # CLI flag: -table-manager.index-table.inactive-write-throughput.scale.in-cooldown + [in_cooldown: | default = 1800] + + # DynamoDB target ratio of consumed capacity to provisioned capacity. + # CLI flag: -table-manager.index-table.inactive-write-throughput.scale.target-value + [target: | default = 80] + + inactive_read_scale: + # Should we enable autoscale for the table. + # CLI flag: -table-manager.index-table.inactive-read-throughput.scale.enabled + [enabled: | default = false] + + # AWS AutoScaling role ARN + # CLI flag: -table-manager.index-table.inactive-read-throughput.scale.role-arn + [role_arn: | default = ""] + + # DynamoDB minimum provision capacity. + # CLI flag: -table-manager.index-table.inactive-read-throughput.scale.min-capacity + [min_capacity: | default = 3000] + + # DynamoDB maximum provision capacity. + # CLI flag: -table-manager.index-table.inactive-read-throughput.scale.max-capacity + [max_capacity: | default = 6000] + + # DynamoDB minimum seconds between each autoscale up. + # CLI flag: -table-manager.index-table.inactive-read-throughput.scale.out-cooldown + [out_cooldown: | default = 1800] + + # DynamoDB minimum seconds between each autoscale down. + # CLI flag: -table-manager.index-table.inactive-read-throughput.scale.in-cooldown + [in_cooldown: | default = 1800] + + # DynamoDB target ratio of consumed capacity to provisioned capacity. + # CLI flag: -table-manager.index-table.inactive-read-throughput.scale.target-value + [target: | default = 80] + + # Number of last inactive tables to enable write autoscale. + # CLI flag: -table-manager.index-table.inactive-write-throughput.scale-last-n + [inactive_write_scale_lastn: | default = 4] + + # Number of last inactive tables to enable read autoscale. + # CLI flag: -table-manager.index-table.inactive-read-throughput.scale-last-n + [inactive_read_scale_lastn: | default = 4] + +chunk_tables_provisioning: + # Enables on demand throughput provisioning for the storage provider (if + # supported). Applies only to tables which are not autoscaled. Supported by + # DynamoDB + # CLI flag: -table-manager.chunk-table.enable-ondemand-throughput-mode + [enable_ondemand_throughput_mode: | default = false] + + # Table default write throughput. Supported by DynamoDB + # CLI flag: -table-manager.chunk-table.write-throughput + [provisioned_write_throughput: | default = 1000] + + # Table default read throughput. Supported by DynamoDB + # CLI flag: -table-manager.chunk-table.read-throughput + [provisioned_read_throughput: | default = 300] + + write_scale: + # Should we enable autoscale for the table. + # CLI flag: -table-manager.chunk-table.write-throughput.scale.enabled + [enabled: | default = false] + + # AWS AutoScaling role ARN + # CLI flag: -table-manager.chunk-table.write-throughput.scale.role-arn + [role_arn: | default = ""] + + # DynamoDB minimum provision capacity. + # CLI flag: -table-manager.chunk-table.write-throughput.scale.min-capacity + [min_capacity: | default = 3000] + + # DynamoDB maximum provision capacity. + # CLI flag: -table-manager.chunk-table.write-throughput.scale.max-capacity + [max_capacity: | default = 6000] + + # DynamoDB minimum seconds between each autoscale up. + # CLI flag: -table-manager.chunk-table.write-throughput.scale.out-cooldown + [out_cooldown: | default = 1800] + + # DynamoDB minimum seconds between each autoscale down. + # CLI flag: -table-manager.chunk-table.write-throughput.scale.in-cooldown + [in_cooldown: | default = 1800] + + # DynamoDB target ratio of consumed capacity to provisioned capacity. + # CLI flag: -table-manager.chunk-table.write-throughput.scale.target-value + [target: | default = 80] + + read_scale: + # Should we enable autoscale for the table. + # CLI flag: -table-manager.chunk-table.read-throughput.scale.enabled + [enabled: | default = false] + + # AWS AutoScaling role ARN + # CLI flag: -table-manager.chunk-table.read-throughput.scale.role-arn + [role_arn: | default = ""] + + # DynamoDB minimum provision capacity. + # CLI flag: -table-manager.chunk-table.read-throughput.scale.min-capacity + [min_capacity: | default = 3000] + + # DynamoDB maximum provision capacity. + # CLI flag: -table-manager.chunk-table.read-throughput.scale.max-capacity + [max_capacity: | default = 6000] + + # DynamoDB minimum seconds between each autoscale up. + # CLI flag: -table-manager.chunk-table.read-throughput.scale.out-cooldown + [out_cooldown: | default = 1800] + + # DynamoDB minimum seconds between each autoscale down. + # CLI flag: -table-manager.chunk-table.read-throughput.scale.in-cooldown + [in_cooldown: | default = 1800] + + # DynamoDB target ratio of consumed capacity to provisioned capacity. + # CLI flag: -table-manager.chunk-table.read-throughput.scale.target-value + [target: | default = 80] + + # Enables on demand throughput provisioning for the storage provider (if + # supported). Applies only to tables which are not autoscaled. Supported by + # DynamoDB + # CLI flag: -table-manager.chunk-table.inactive-enable-ondemand-throughput-mode + [enable_inactive_throughput_on_demand_mode: | default = false] + + # Table write throughput for inactive tables. Supported by DynamoDB + # CLI flag: -table-manager.chunk-table.inactive-write-throughput + [inactive_write_throughput: | default = 1] + + # Table read throughput for inactive tables. Supported by DynamoDB + # CLI flag: -table-manager.chunk-table.inactive-read-throughput + [inactive_read_throughput: | default = 300] + + inactive_write_scale: + # Should we enable autoscale for the table. + # CLI flag: -table-manager.chunk-table.inactive-write-throughput.scale.enabled + [enabled: | default = false] + + # AWS AutoScaling role ARN + # CLI flag: -table-manager.chunk-table.inactive-write-throughput.scale.role-arn + [role_arn: | default = ""] + + # DynamoDB minimum provision capacity. + # CLI flag: -table-manager.chunk-table.inactive-write-throughput.scale.min-capacity + [min_capacity: | default = 3000] + + # DynamoDB maximum provision capacity. + # CLI flag: -table-manager.chunk-table.inactive-write-throughput.scale.max-capacity + [max_capacity: | default = 6000] + + # DynamoDB minimum seconds between each autoscale up. + # CLI flag: -table-manager.chunk-table.inactive-write-throughput.scale.out-cooldown + [out_cooldown: | default = 1800] + + # DynamoDB minimum seconds between each autoscale down. + # CLI flag: -table-manager.chunk-table.inactive-write-throughput.scale.in-cooldown + [in_cooldown: | default = 1800] + + # DynamoDB target ratio of consumed capacity to provisioned capacity. + # CLI flag: -table-manager.chunk-table.inactive-write-throughput.scale.target-value + [target: | default = 80] + + inactive_read_scale: + # Should we enable autoscale for the table. + # CLI flag: -table-manager.chunk-table.inactive-read-throughput.scale.enabled + [enabled: | default = false] + + # AWS AutoScaling role ARN + # CLI flag: -table-manager.chunk-table.inactive-read-throughput.scale.role-arn + [role_arn: | default = ""] + + # DynamoDB minimum provision capacity. + # CLI flag: -table-manager.chunk-table.inactive-read-throughput.scale.min-capacity + [min_capacity: | default = 3000] + + # DynamoDB maximum provision capacity. + # CLI flag: -table-manager.chunk-table.inactive-read-throughput.scale.max-capacity + [max_capacity: | default = 6000] + + # DynamoDB minimum seconds between each autoscale up. + # CLI flag: -table-manager.chunk-table.inactive-read-throughput.scale.out-cooldown + [out_cooldown: | default = 1800] + + # DynamoDB minimum seconds between each autoscale down. + # CLI flag: -table-manager.chunk-table.inactive-read-throughput.scale.in-cooldown + [in_cooldown: | default = 1800] + + # DynamoDB target ratio of consumed capacity to provisioned capacity. + # CLI flag: -table-manager.chunk-table.inactive-read-throughput.scale.target-value + [target: | default = 80] + + # Number of last inactive tables to enable write autoscale. + # CLI flag: -table-manager.chunk-table.inactive-write-throughput.scale-last-n + [inactive_write_scale_lastn: | default = 4] + + # Number of last inactive tables to enable read autoscale. + # CLI flag: -table-manager.chunk-table.inactive-read-throughput.scale-last-n + [inactive_read_scale_lastn: | default = 4] ``` -### provision_config +### runtime_config -The `provision_config` block configures provisioning capacity for DynamoDB. +Configuration for 'runtime config' module, responsible for reloading runtime configuration file. ```yaml -# Enables on-demand throughput provisioning for the storage -# provider, if supported. Applies only to tables which are not autoscaled. -# CLI flag: -.enable-ondemand-throughput-mode -[enable_ondemand_throughput_mode: | default = false] - -# DynamoDB table default write throughput. -# CLI flag: -.write-throughput -[provisioned_write_throughput: | default = 3000] - -# DynamoDB table default read throughput. -# CLI flag: -.read-throughput -[provisioned_read_throughput: | default = 300] - -# Enables on-demand throughput provisioning for the storage provide, -# if supported. Applies only to tables which are not autoscaled. -# CLI flag: -.inactive-enable-ondemand-throughput-mode -[enable_inactive_throughput_on_demand_mode: | default = false] - -# DynamoDB table write throughput for inactive tables. -# CLI flag: -.inactive-write-throughput -[inactive_write_throughput: | default = 1] - -# DynamoDB table read throughput for inactive tables. -# CLI flag: -.inactive-read-throughput -[inactive_read_throughput: | default = 300] - -# Active table write autoscale config. -# The CLI flags prefix for this block config is: -.write-throughput -[write_scale: ] - -# Inactive table write autoscale config. -# The CLI flags prefix for this block config is: -.inactive-write-throughput -[inactive_write_scale: ] - -# Number of last inactive tables to enable write autoscale. -# CLI flag: -.enable-ondemand-throughput-mode -[inactive_write_scale_lastn: ] - -# Active table read autoscale config. -# The CLI flags prefix for this block config is: -.read-throughput -[read_scale: ] - -# Inactive table read autoscale config. -# The CLI flags prefix for this block config is: -.inactive-read-throughput -[inactive_read_scale: ] - -# Number of last inactive tables to enable read autoscale. -# CLI flag: -.enable-ondemand-throughput-mode -[inactive_read_scale_lastn: ] +# How often to check runtime config files. +# CLI flag: -runtime-config.reload-period +[period: | default = 10s] + +# Comma separated list of yaml files with the configuration that can be updated +# at runtime. Runtime config files will be merged from left to right. +# CLI flag: -runtime-config.file +[file: | default = ""] ``` -#### auto_scaling_config +### tracing -The `auto_scaling_config` block configures autoscaling for DynamoDB. +Configuration for `tracing`. ```yaml -# Whether or not autoscaling should be enabled. -# CLI flag: -.scale.enabled -[enabled: : default = false] - -# AWS AutoScaling role ARN. -# CLI flag: -.scale.role-arn -[role_arn: ] - -# DynamoDB minimum provision capacity. -# CLI flag: -.scale.min-capacity -[min_capacity: | default = 3000] - -# DynamoDB maximum provision capacity. -# CLI flag: -.scale.max-capacity -[max_capacity: | default = 6000] - -# DynamoDB minimum seconds between each autoscale up. -# CLI flag: -.scale.out-cooldown -[out_cooldown: | default = 1800] - -# DynamoDB minimum seconds between each autoscale down. -# CLI flag: -.scale.in-cooldown -[in_cooldown: | default = 1800] - -# DynamoDB target ratio of consumed capacity to provisioned capacity. -# CLI flag: -.scale.target-value -[target: | default = 80] +# Set to false to disable tracing. +# CLI flag: -tracing.enabled +[enabled: | default = true] ``` -## tracing +### analytics -The `tracing` block configures tracing for Jaeger. Currently limited to disable auto-configuration per [environment variables](https://www.jaegertracing.io/docs/1.16/client-features/) only. +Configuration for usage report. ```yaml -# Whether or not tracing should be enabled. -# CLI flag: -tracing.enabled -[enabled: : default = true] +# Enable anonymous usage reporting. +# CLI flag: -reporting.enabled +[reporting_enabled: | default = true] ``` -## common +### common -The `common` block sets common definitions to be shared by different components. -This way, one doesn't have to replicate configuration in multiple places. +Common configuration to be shared between multiple modules. If a more specific configuration is given in other sections, the related configuration within this section will be ignored. ```yaml -# A common storage configuration to be used by the different Loki components. -[storage: ] - -# When defined, the given prefix will be present in front of the endpoint paths. -[path_prefix: ] - -# How many times incoming data should be replicated to the ingester component. -[replication_factor: | default = 3] - -# When true, the ingester, compactor, and query_scheduler ring tokens will be saved -# to files in the path_prefix directory. Loki will error if you set this to true -# and path_prefix is empty. -[persist_tokens: : default = false] - -# A common list of net interfaces used internally to look for addresses. -# If a more specific "instance_interface_names" is set, this is ignored. -# If "instance_interface_names" under the common ring section is configured, -# this common "instance_interface_names" is only applied to the frontend, but not for -# ring related components (ex: distributor, ruler, etc). -[instance_interface_names: | default = []] - -# A common address used by Loki components to advertise their address. -# If a more specific "instance_addr" is set, this is ignored. -# If "instance_addr" under the common ring section is configured, this common "instance_addr" -# is only applied to the frontend, but not for ring related components (ex: distributor, ruler, etc). -[instance_addr: ] - -# A common ring configuration to be used by all Loki rings. -# If a common ring is given, its values are used to define any undefined ring values. -# For instance, you can expect the `heartbeat_period` defined in the common section -# to be used by the distributor's ring, but only if the distributor's ring itself -# doesn't have a `heartbeat_period` set. -[ring: ] - -# Address and port number where the compactor API is served. -# CLI flag: -common.compactor-address -[compactor_address: | default = ""] +[path_prefix: | default = ""] -# Address and port number where the compactor grpc requests are being served. -# CLI flag: -common.compactor-grpc-address +storage: + # The s3_storage_config block configures the connection to Amazon S3 object + # storage backend. + # The CLI flags prefix for this block configuration is: common + [s3: ] + + # The gcs_storage_config block configures the connection to Google Cloud + # Storage object storage backend. + # The CLI flags prefix for this block configuration is: common.storage + [gcs: ] + + # The azure_storage_config block configures the connection to Azure object + # storage backend. + # The CLI flags prefix for this block configuration is: common.storage + [azure: ] + + # The bos_storage_config block configures the connection to Baidu Object + # Storage (BOS) object storage backend. + # The CLI flags prefix for this block configuration is: common.storage + [bos: ] + + # The swift_storage_config block configures the connection to OpenStack Object + # Storage (Swift) object storage backend. + # The CLI flags prefix for this block configuration is: common.storage + [swift: ] + + filesystem: + # Directory to store chunks in. + # CLI flag: -common.storage.filesystem.chunk-directory + [chunks_directory: | default = ""] + + # Directory to store rules in. + # CLI flag: -common.storage.filesystem.rules-directory + [rules_directory: | default = ""] + + hedging: + # If set to a non-zero value a second request will be issued at the provided + # duration. Default is 0 (disabled) + # CLI flag: -common.storage.hedge-requests-at + [at: | default = 0s] + + # The maximum of hedge requests allowed. + # CLI flag: -common.storage.hedge-requests-up-to + [up_to: | default = 2] + + # The maximum of hedge requests allowed per seconds. + # CLI flag: -common.storage.hedge-max-per-second + [max_per_second: | default = 5] + +[persist_tokens: ] + +[replication_factor: ] + +ring: + kvstore: + # Backend storage to use for the ring. Supported values are: consul, etcd, + # inmemory, memberlist, multi. + # CLI flag: -common.storage.ring.store + [store: | default = "consul"] + + # The prefix for the keys in the store. Should end with a /. + # CLI flag: -common.storage.ring.prefix + [prefix: | default = "collectors/"] + + # Configuration for a Consul client. Only applies if store is consul. + # The CLI flags prefix for this block configuration is: common.storage.ring + [consul: ] + + # Configuration for an ETCD v3 client. Only applies if store is etcd. + # The CLI flags prefix for this block configuration is: common.storage.ring + [etcd: ] + + multi: + # Primary backend storage used by multi-client. + # CLI flag: -common.storage.ring.multi.primary + [primary: | default = ""] + + # Secondary backend storage used by multi-client. + # CLI flag: -common.storage.ring.multi.secondary + [secondary: | default = ""] + + # Mirror writes to secondary store. + # CLI flag: -common.storage.ring.multi.mirror-enabled + [mirror_enabled: | default = false] + + # Timeout for storing value to secondary store. + # CLI flag: -common.storage.ring.multi.mirror-timeout + [mirror_timeout: | default = 2s] + + # Period at which to heartbeat to the ring. 0 = disabled. + # CLI flag: -common.storage.ring.heartbeat-period + [heartbeat_period: | default = 15s] + + # The heartbeat timeout after which compactors are considered unhealthy within + # the ring. 0 = never (timeout disabled). + # CLI flag: -common.storage.ring.heartbeat-timeout + [heartbeat_timeout: | default = 1m] + + # File path where tokens are stored. If empty, tokens are not stored at + # shutdown and restored at startup. + # CLI flag: -common.storage.ring.tokens-file-path + [tokens_file_path: | default = ""] + + # True to enable zone-awareness and replicate blocks across different + # availability zones. + # CLI flag: -common.storage.ring.zone-awareness-enabled + [zone_awareness_enabled: | default = false] + + # Instance ID to register in the ring. + # CLI flag: -common.storage.ring.instance-id + [instance_id: | default = ""] + + # Name of network interface to read address from. + # CLI flag: -common.storage.ring.instance-interface-names + [instance_interface_names: | default = []] + + # Port to advertise in the ring (defaults to server.grpc-listen-port). + # CLI flag: -common.storage.ring.instance-port + [instance_port: | default = 0] + + # IP address to advertise in the ring. + # CLI flag: -common.storage.ring.instance-addr + [instance_addr: | default = ""] + + # The availability zone where this instance is running. Required if + # zone-awareness is enabled. + # CLI flag: -common.storage.ring.instance-availability-zone + [instance_availability_zone: | default = ""] + +[instance_interface_names: ] + +[instance_addr: | default = ""] + +# the http address of the compactor in the form http://host:port +# CLI flag: -common.compactor-address +[compactor_address: | default = ""] + +# the grpc address of the compactor in the form host:port +# CLI flag: -common.compactor-grpc-address [compactor_grpc_address: | default = ""] +``` + +### consul -## analytics +Configuration for a Consul client. Only applies if store is `consul`. The supported CLI flags `` used to reference this configuration block are: -The `analytics` block configures the reporting of Loki analytics to grafana.com. +- `boltdb.shipper.compactor.ring` +- `common.storage.ring` +- `distributor.ring` +- `index-gateway.ring` +- `query-scheduler.ring` +- `ruler.ring` + +  ```yaml -# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration -# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/ -# -# Statistics help us better understand how Loki is used, and they show us performance -# levels for most users. This helps us prioritize features and documentation. -# For more information on what's sent, look at -# https://github.com/grafana/loki/blob/main/pkg/usagestats/stats.go -# Refer to the buildReport method to see what goes into a report. -# -# When true, enables usage reporting. -# CLI flag: -reporting.enabled -[reporting_enabled: : default = true] +# Hostname and port of Consul. +# CLI flag: -.consul.hostname +[host: | default = "localhost:8500"] + +# ACL Token used to interact with Consul. +# CLI flag: -.consul.acl-token +[acl_token: | default = ""] + +# HTTP timeout when talking to Consul +# CLI flag: -.consul.client-timeout +[http_client_timeout: | default = 20s] + +# Enable consistent reads to Consul. +# CLI flag: -.consul.consistent-reads +[consistent_reads: | default = false] + +# Rate limit when watching key or prefix in Consul, in requests per second. 0 +# disables the rate limit. +# CLI flag: -.consul.watch-rate-limit +[watch_rate_limit: | default = 1] + +# Burst size used in rate limit. Values less than 1 are treated as 1. +# CLI flag: -.consul.watch-burst-size +[watch_burst_size: | default = 1] + +# Maximum duration to wait before retrying a Compare And Swap (CAS) operation. +# CLI flag: -.consul.cas-retry-delay +[cas_retry_delay: | default = 1s] ``` -### storage +### etcd + +Configuration for an ETCD v3 client. Only applies if store is `etcd`. The supported CLI flags `` used to reference this configuration block are: -The common `storage` block defines a common storage to be reused by different -components as a way to facilitate storage configuration. -If any specific configuration for an object storage client have been provided elsewhere in the configuration file, the specific configuration will supersede the common storage configuration. +- `boltdb.shipper.compactor.ring` +- `common.storage.ring` +- `distributor.ring` +- `index-gateway.ring` +- `query-scheduler.ring` +- `ruler.ring` + +  ```yaml -# Configures Azure as the common storage. -[azure: ] +# The etcd endpoints to connect to. +# CLI flag: -.etcd.endpoints +[endpoints: | default = []] -# Configures GCS as the common storage. -[gcs: ] +# The dial timeout for the etcd connection. +# CLI flag: -.etcd.dial-timeout +[dial_timeout: | default = 10s] -# Configures S3 as the common storage. -[s3: ] +# The maximum number of retries to do for failed ops. +# CLI flag: -.etcd.max-retries +[max_retries: | default = 10] -# Configures Swift as the common storage. -[swift: ] +# Enable TLS. +# CLI flag: -.etcd.tls-enabled +[tls_enabled: | default = false] + +# Path to the client certificate file, which will be used for authenticating +# with the server. Also requires the key path to be configured. +# CLI flag: -.etcd.tls-cert-path +[tls_cert_path: | default = ""] + +# Path to the key file for the client certificate. Also requires the client +# certificate to be configured. +# CLI flag: -.etcd.tls-key-path +[tls_key_path: | default = ""] + +# Path to the CA certificates file to validate server certificate against. If +# not set, the host's root CA certificates are used. +# CLI flag: -.etcd.tls-ca-path +[tls_ca_path: | default = ""] + +# Override the expected name on the server certificate. +# CLI flag: -.etcd.tls-server-name +[tls_server_name: | default = ""] + +# Skip validating server certificate. +# CLI flag: -.etcd.tls-insecure-skip-verify +[tls_insecure_skip_verify: | default = false] + +# Override the default cipher suite list (separated by commas). Allowed values: +# +# Secure Ciphers: +# - TLS_RSA_WITH_AES_128_CBC_SHA +# - TLS_RSA_WITH_AES_256_CBC_SHA +# - TLS_RSA_WITH_AES_128_GCM_SHA256 +# - TLS_RSA_WITH_AES_256_GCM_SHA384 +# - TLS_AES_128_GCM_SHA256 +# - TLS_AES_256_GCM_SHA384 +# - TLS_CHACHA20_POLY1305_SHA256 +# - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA +# - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA +# - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA +# - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA +# - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 +# - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 +# - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 +# - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 +# - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 +# - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 +# +# Insecure Ciphers: +# - TLS_RSA_WITH_RC4_128_SHA +# - TLS_RSA_WITH_3DES_EDE_CBC_SHA +# - TLS_RSA_WITH_AES_128_CBC_SHA256 +# - TLS_ECDHE_ECDSA_WITH_RC4_128_SHA +# - TLS_ECDHE_RSA_WITH_RC4_128_SHA +# - TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA +# - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 +# - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 +# CLI flag: -.etcd.tls-cipher-suites +[tls_cipher_suites: | default = ""] + +# Override the default minimum TLS version. Allowed values: VersionTLS10, +# VersionTLS11, VersionTLS12, VersionTLS13 +# CLI flag: -.etcd.tls-min-version +[tls_min_version: | default = ""] + +# Etcd username. +# CLI flag: -.etcd.username +[username: | default = ""] -# Configures a (local) file system as the common storage. -[filesystem: ] +# Etcd password. +# CLI flag: -.etcd.password +[password: | default = ""] +``` -# Configures Baidu Object Storage (BOS) as the common storage. -[bos: ] +### grpc_client + +The `grpc_client` block configures the gRPC client used to communicate between two Loki components. The supported CLI flags `` used to reference this configuration block are: + +- `bigtable` +- `boltdb.shipper.index-gateway-client.grpc` +- `frontend.grpc-client-config` +- `ingester.client` +- `querier.frontend-client` +- `query-scheduler.grpc-client-config` +- `ruler.client` +- `tsdb.shipper.index-gateway-client.grpc` + +  + +```yaml +# gRPC client max receive message size (bytes). +# CLI flag: -.grpc-max-recv-msg-size +[max_recv_msg_size: | default = 104857600] + +# gRPC client max send message size (bytes). +# CLI flag: -.grpc-max-send-msg-size +[max_send_msg_size: | default = 104857600] + +# Use compression when sending messages. Supported values are: 'gzip', 'snappy' +# and '' (disable compression) +# CLI flag: -.grpc-compression +[grpc_compression: | default = ""] + +# Rate limit for gRPC client; 0 means disabled. +# CLI flag: -.grpc-client-rate-limit +[rate_limit: | default = 0] + +# Rate limit burst for gRPC client. +# CLI flag: -.grpc-client-rate-limit-burst +[rate_limit_burst: | default = 0] -# The `hedging_config` configures how to hedge requests for the storage. -[hedging: ] +# Enable backoff and retry when we hit ratelimits. +# CLI flag: -.backoff-on-ratelimits +[backoff_on_ratelimits: | default = false] +backoff_config: + # Minimum delay when backing off. + # CLI flag: -.backoff-min-period + [min_period: | default = 100ms] + + # Maximum delay when backing off. + # CLI flag: -.backoff-max-period + [max_period: | default = 10s] + + # Number of times to backoff and retry before failing. + # CLI flag: -.backoff-retries + [max_retries: | default = 10] + +# Enable TLS in the GRPC client. This flag needs to be enabled when any other +# TLS flag is set. If set to false, insecure connection to gRPC server will be +# used. +# CLI flag: -.tls-enabled +[tls_enabled: | default = false] + +# Path to the client certificate file, which will be used for authenticating +# with the server. Also requires the key path to be configured. +# CLI flag: -.tls-cert-path +[tls_cert_path: | default = ""] + +# Path to the key file for the client certificate. Also requires the client +# certificate to be configured. +# CLI flag: -.tls-key-path +[tls_key_path: | default = ""] + +# Path to the CA certificates file to validate server certificate against. If +# not set, the host's root CA certificates are used. +# CLI flag: -.tls-ca-path +[tls_ca_path: | default = ""] + +# Override the expected name on the server certificate. +# CLI flag: -.tls-server-name +[tls_server_name: | default = ""] + +# Skip validating server certificate. +# CLI flag: -.tls-insecure-skip-verify +[tls_insecure_skip_verify: | default = false] + +# Override the default cipher suite list (separated by commas). Allowed values: +# +# Secure Ciphers: +# - TLS_RSA_WITH_AES_128_CBC_SHA +# - TLS_RSA_WITH_AES_256_CBC_SHA +# - TLS_RSA_WITH_AES_128_GCM_SHA256 +# - TLS_RSA_WITH_AES_256_GCM_SHA384 +# - TLS_AES_128_GCM_SHA256 +# - TLS_AES_256_GCM_SHA384 +# - TLS_CHACHA20_POLY1305_SHA256 +# - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA +# - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA +# - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA +# - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA +# - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 +# - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 +# - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 +# - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 +# - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 +# - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 +# +# Insecure Ciphers: +# - TLS_RSA_WITH_RC4_128_SHA +# - TLS_RSA_WITH_3DES_EDE_CBC_SHA +# - TLS_RSA_WITH_AES_128_CBC_SHA256 +# - TLS_ECDHE_ECDSA_WITH_RC4_128_SHA +# - TLS_ECDHE_RSA_WITH_RC4_128_SHA +# - TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA +# - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 +# - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 +# CLI flag: -.tls-cipher-suites +[tls_cipher_suites: | default = ""] + +# Override the default minimum TLS version. Allowed values: VersionTLS10, +# VersionTLS11, VersionTLS12, VersionTLS13 +# CLI flag: -.tls-min-version +[tls_min_version: | default = ""] ``` -### filesystem +### tls_config -The common `filesystem` block configures a local file system as a general -storage for various types of data generated by Loki. +The TLS configuration. ```yaml -# File system directory to be used for chunks storage. -[chunks_directory: | default = ""] +# Path to the client certificate file, which will be used for authenticating +# with the server. Also requires the key path to be configured. +# CLI flag: -frontend.tail-tls-config.tls-cert-path +[tls_cert_path: | default = ""] + +# Path to the key file for the client certificate. Also requires the client +# certificate to be configured. +# CLI flag: -frontend.tail-tls-config.tls-key-path +[tls_key_path: | default = ""] + +# Path to the CA certificates file to validate server certificate against. If +# not set, the host's root CA certificates are used. +# CLI flag: -frontend.tail-tls-config.tls-ca-path +[tls_ca_path: | default = ""] + +# Override the expected name on the server certificate. +# CLI flag: -frontend.tail-tls-config.tls-server-name +[tls_server_name: | default = ""] + +# Skip validating server certificate. +# CLI flag: -frontend.tail-tls-config.tls-insecure-skip-verify +[tls_insecure_skip_verify: | default = false] + +# Override the default cipher suite list (separated by commas). Allowed values: +# +# Secure Ciphers: +# - TLS_RSA_WITH_AES_128_CBC_SHA +# - TLS_RSA_WITH_AES_256_CBC_SHA +# - TLS_RSA_WITH_AES_128_GCM_SHA256 +# - TLS_RSA_WITH_AES_256_GCM_SHA384 +# - TLS_AES_128_GCM_SHA256 +# - TLS_AES_256_GCM_SHA384 +# - TLS_CHACHA20_POLY1305_SHA256 +# - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA +# - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA +# - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA +# - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA +# - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 +# - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 +# - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 +# - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 +# - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 +# - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 +# +# Insecure Ciphers: +# - TLS_RSA_WITH_RC4_128_SHA +# - TLS_RSA_WITH_3DES_EDE_CBC_SHA +# - TLS_RSA_WITH_AES_128_CBC_SHA256 +# - TLS_ECDHE_ECDSA_WITH_RC4_128_SHA +# - TLS_ECDHE_RSA_WITH_RC4_128_SHA +# - TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA +# - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 +# - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 +# CLI flag: -frontend.tail-tls-config.tls-cipher-suites +[tls_cipher_suites: | default = ""] + +# Override the default minimum TLS version. Allowed values: VersionTLS10, +# VersionTLS11, VersionTLS12, VersionTLS13 +# CLI flag: -frontend.tail-tls-config.tls-min-version +[tls_min_version: | default = ""] +``` + +### cache_config + +The cache block configures the cache backend. The supported CLI flags `` used to reference this configuration block are: + +- `frontend` +- `store.chunks-cache` +- `store.index-cache-read` +- `store.index-cache-write` + +  + +```yaml +# Cache config for index entry writing.(deprecated: use embedded-cache instead) +# Enable in-memory cache (auto-enabled for the chunks & query results cache if +# no other cache is configured). +# CLI flag: -.cache.enable-fifocache +[enable_fifocache: | default = false] + +# Cache config for index entry writing.The default validity of entries for +# caches unless overridden. +# CLI flag: -.default-validity +[default_validity: | default = 1h] + +background: + # Cache config for index entry writing.At what concurrency to write back to + # cache. + # CLI flag: -.background.write-back-concurrency + [writeback_goroutines: | default = 10] + + # Cache config for index entry writing.How many key batches to buffer for + # background write-back. + # CLI flag: -.background.write-back-buffer + [writeback_buffer: | default = 10000] + +memcached: + # Cache config for index entry writing.How long keys stay in the memcache. + # CLI flag: -.memcached.expiration + [expiration: | default = 0s] + + # Cache config for index entry writing.How many keys to fetch in each batch. + # CLI flag: -.memcached.batchsize + [batch_size: | default = 1024] + + # Cache config for index entry writing.Maximum active requests to memcache. + # CLI flag: -.memcached.parallelism + [parallelism: | default = 100] + +memcached_client: + # Cache config for index entry writing.Hostname for memcached service to use. + # If empty and if addresses is unset, no memcached will be used. + # CLI flag: -.memcached.hostname + [host: | default = ""] + + # Cache config for index entry writing.SRV service used to discover memcache + # servers. + # CLI flag: -.memcached.service + [service: | default = "memcached"] + + # Cache config for index entry writing.EXPERIMENTAL: Comma separated addresses + # list in DNS Service Discovery format: + # https://cortexmetrics.io/docs/configuration/arguments/#dns-service-discovery + # CLI flag: -.memcached.addresses + [addresses: | default = ""] + + # Cache config for index entry writing.Maximum time to wait before giving up + # on memcached requests. + # CLI flag: -.memcached.timeout + [timeout: | default = 100ms] + + # Cache config for index entry writing.Maximum number of idle connections in + # pool. + # CLI flag: -.memcached.max-idle-conns + [max_idle_conns: | default = 16] + + # Cache config for index entry writing.The maximum size of an item stored in + # memcached. Bigger items are not stored. If set to 0, no maximum size is + # enforced. + # CLI flag: -.memcached.max-item-size + [max_item_size: | default = 0] + + # Cache config for index entry writing.Period with which to poll DNS for + # memcache servers. + # CLI flag: -.memcached.update-interval + [update_interval: | default = 1m] + + # Cache config for index entry writing.Use consistent hashing to distribute to + # memcache servers. + # CLI flag: -.memcached.consistent-hash + [consistent_hash: | default = true] + + # Cache config for index entry writing.Trip circuit-breaker after this number + # of consecutive dial failures (if zero then circuit-breaker is disabled). + # CLI flag: -.memcached.circuit-breaker-consecutive-failures + [circuit_breaker_consecutive_failures: | default = 10] + + # Cache config for index entry writing.Duration circuit-breaker remains open + # after tripping (if zero then 60 seconds is used). + # CLI flag: -.memcached.circuit-breaker-timeout + [circuit_breaker_timeout: | default = 10s] + + # Cache config for index entry writing.Reset circuit-breaker counts after this + # long (if zero then never reset). + # CLI flag: -.memcached.circuit-breaker-interval + [circuit_breaker_interval: | default = 10s] + +redis: + # Cache config for index entry writing.Redis Server or Cluster configuration + # endpoint to use for caching. A comma-separated list of endpoints for Redis + # Cluster or Redis Sentinel. If empty, no redis will be used. + # CLI flag: -.redis.endpoint + [endpoint: | default = ""] + + # Cache config for index entry writing.Redis Sentinel master name. An empty + # string for Redis Server or Redis Cluster. + # CLI flag: -.redis.master-name + [master_name: | default = ""] + + # Cache config for index entry writing.Maximum time to wait before giving up + # on redis requests. + # CLI flag: -.redis.timeout + [timeout: | default = 500ms] + + # Cache config for index entry writing.How long keys stay in the redis. + # CLI flag: -.redis.expiration + [expiration: | default = 0s] + + # Cache config for index entry writing.Database index. + # CLI flag: -.redis.db + [db: | default = 0] + + # Cache config for index entry writing.Maximum number of connections in the + # pool. + # CLI flag: -.redis.pool-size + [pool_size: | default = 0] + + # Cache config for index entry writing.Username to use when connecting to + # redis. + # CLI flag: -.redis.username + [username: | default = ""] + + # Cache config for index entry writing.Password to use when connecting to + # redis. + # CLI flag: -.redis.password + [password: | default = ""] + + # Cache config for index entry writing.Enable connecting to redis with TLS. + # CLI flag: -.redis.tls-enabled + [tls_enabled: | default = false] + + # Cache config for index entry writing.Skip validating server certificate. + # CLI flag: -.redis.tls-insecure-skip-verify + [tls_insecure_skip_verify: | default = false] + + # Cache config for index entry writing.Close connections after remaining idle + # for this duration. If the value is zero, then idle connections are not + # closed. + # CLI flag: -.redis.idle-timeout + [idle_timeout: | default = 0s] + + # Cache config for index entry writing.Close connections older than this + # duration. If the value is zero, then the pool does not close connections + # based on age. + # CLI flag: -.redis.max-connection-age + [max_connection_age: | default = 0s] + +embedded_cache: + # Cache config for index entry writing.Whether embedded cache is enabled. + # CLI flag: -.embedded-cache.enabled + [enabled: | default = false] + + # Cache config for index entry writing.Maximum memory size of the cache in MB. + # CLI flag: -.embedded-cache.max-size-mb + [max_size_mb: | default = 100] + + # Cache config for index entry writing.The time to live for items in the cache + # before they get purged. + # CLI flag: -.embedded-cache.ttl + [ttl: | default = 1h] + +fifocache: + # Cache config for index entry writing.Maximum memory size of the cache in + # bytes. A unit suffix (KB, MB, GB) may be applied. + # CLI flag: -.fifocache.max-size-bytes + [max_size_bytes: | default = "1GB"] + + # Cache config for index entry writing.deprecated: Maximum number of entries + # in the cache. + # CLI flag: -.fifocache.max-size-items + [max_size_items: | default = 0] -# File system directory to be used for rules storage. -[rules_directory: | default = ""] + # Cache config for index entry writing.The time to live for items in the cache + # before they get purged. + # CLI flag: -.fifocache.ttl + [ttl: | default = 1h] + + # Deprecated (use ttl instead): Cache config for index entry writing.The + # expiry duration for the cache. + # CLI flag: -.fifocache.duration + [validity: | default = 0s] + + # Deprecated (use max-size-items or max-size-bytes instead): Cache config for + # index entry writing.The number of entries to cache. + # CLI flag: -.fifocache.size + [size: | default = 0] + + [purgeinterval: ] + +# The maximum number of concurrent asynchronous writeback cache can occur. +# CLI flag: -.max-async-cache-write-back-concurrency +[async_cache_write_back_concurrency: | default = 16] + +# The maximum number of enqueued asynchronous writeback cache allowed. +# CLI flag: -.max-async-cache-write-back-buffer-size +[async_cache_write_back_buffer_size: | default = 500] ``` -### ring +### period_config -The common `ring` block defines a ring configuration used by a Loki component. +The `period_config` block configures what index schemas should be used for from specific time periods. ```yaml -# The key-value store used to share the hash ring across multiple instances. -kvstore: - # Backend storage to use for the ring. Supported values are: consul, etcd, - # inmemory, memberlist, multi. - # CLI flag: -.store - [store: | default = "memberlist"] - - # The prefix for the keys in the store. Should end with a /. - # CLI flag: -.prefix - [prefix: | default = "collectors/"] - - # The consul_config configures the consul client. - [consul: ] - - # The etcd_config configures the etcd client. - [etcd: ] - - multi: - # Primary backend storage used by multi-client. - # CLI flag: -.multi.primary - [primary: | default = ""] - - # Secondary backend storage used by multi-client. - # CLI flag: -.multi.secondary - [secondary: | default = ""] - - # Mirror writes to secondary store. - # CLI flag: -.multi.mirror-enabled - [mirror_enabled: | default = false] - - # Timeout for storing value to secondary store. - # CLI flag: -.multi.mirror-timeout - [mirror_timeout: | default = 2s] - -# Interval between heartbeats sent to the ring. 0 = disabled. -# CLI flag: -.heartbeat-period -[heartbeat_period: | default = 15s] - -# The heartbeat timeout after which store gateways are considered unhealthy -# within the ring. 0 = never (timeout disabled). This option needs be set both -# on the store-gateway and querier when running in microservices mode. -# CLI flag: -.heartbeat-timeout -[heartbeat_timeout: | default = 1m] - -# File path where tokens are stored. If empty, tokens are neither stored at -# shutdown nor restored at startup. -# CLI flag: -.tokens-file-path -[tokens_file_path: | default = ""] - -# True to enable zone-awareness and replicate blocks across different -# availability zones. -# CLI flag: -.zone-awareness-enabled -[zone_awareness_enabled: | default = false] - -# Name of network interface to read addresses from. -# CLI flag: -.instance-interface-names -[instance_interface_names: | default = []] - -# IP address to advertise in the ring. -# CLI flag: -.instance-addr -[instance_addr: | default = first from instance_interface_names] - -# Port to advertise in the ring -# CLI flag: -.instance-port -[instance_port: | default = server.grpc-listen-port] - -# Instance ID to register in the ring. -# CLI flag: -.instance-id -[instance_id: | default = os.Hostname()] - -# The availability zone where this instance is running. Required if -# zone-awareness is enabled. -# CLI flag: -.instance-availability-zone -[instance_availability_zone: | default = ""] +# The date of the first day that index buckets should be created. Use a date in +# the past if this is your only period_config, otherwise use a date when you +# want the schema to switch over. In YYYY-MM-DD format, for example: 2018-04-15. +[from: ] + +# store and object_store below affect which key is used. +# Which store to use for the index. Either aws, aws-dynamo, gcp, bigtable, +# bigtable-hashed, cassandra, boltdb or boltdb-shipper. +[store: | default = ""] + +# Which store to use for the chunks. Either aws, azure, gcp, bigtable, gcs, +# cassandra, swift or filesystem. If omitted, defaults to the same value as +# store. +[object_store: | default = ""] + +# The schema version to use, current recommended schema is v11. +[schema: | default = ""] + +# Configures how the index is updated and stored. +index: + # Table prefix for all period tables. + [prefix: | default = ""] + + # Table period. + [period: ] + + # A map to be added to all managed tables. + [tags: ] + +# Configured how the chunks are updated and stored. +chunks: + # Table prefix for all period tables. + [prefix: | default = ""] + + # Table period. + [period: ] + + # A map to be added to all managed tables. + [tags: ] + +# How many shards will be created. Only used if schema is v10 or greater. +[row_shards: ] ``` -## Runtime Configuration file +### azure_storage_config -Loki has a concept of "runtime config" file, which is simply a file that is reloaded while Loki is running. It is used by some Loki components to allow operator to change some aspects of Loki configuration without restarting it. File is specified by using `-runtime-config.file=` flag and reload period (which defaults to 10 seconds) can be changed by `-runtime-config.reload-period=` flag. Previously this mechanism was only used by limits overrides, and flags were called `-limits.per-user-override-config=` and `-limits.per-user-override-period=10s` respectively. These are still used, if `-runtime-config.file=` is not specified. +The `azure_storage_config` block configures the connection to Azure object storage backend. The supported CLI flags `` used to reference this configuration block are: -At the moment, two components use runtime configuration: limits and multi KV store. +- `common.storage` +- `ruler.storage` -Options for runtime configuration reload can also be configured via YAML: +  ```yaml -# Configuration file to periodically check and reload. -[file: : default = empty] +# Azure Cloud environment. Supported values are: AzureGlobal, AzureChinaCloud, +# AzureGermanCloud, AzureUSGovernment. +# CLI flag: -.azure.environment +[environment: | default = "AzureGlobal"] + +# Azure storage account name. +# CLI flag: -.azure.account-name +[account_name: | default = ""] + +# Azure storage account key. +# CLI flag: -.azure.account-key +[account_key: | default = ""] + +# Name of the storage account blob container used to store chunks. This +# container must be created before running cortex. +# CLI flag: -.azure.container-name +[container_name: | default = "loki"] + +# Azure storage endpoint suffix without schema. The storage account name will be +# prefixed to this value to create the FQDN. +# CLI flag: -.azure.endpoint-suffix +[endpoint_suffix: | default = ""] + +# Use Managed Identity to authenticate to the Azure storage account. +# CLI flag: -.azure.use-managed-identity +[use_managed_identity: | default = false] -# How often to check the file. -[period: : default 10s] +# User assigned identity ID to authenticate to the Azure storage account. +# CLI flag: -.azure.user-assigned-id +[user_assigned_id: | default = ""] + +# Use Service Principal to authenticate through Azure OAuth. +# CLI flag: -.azure.use-service-principal +[use_service_principal: | default = false] + +# Azure Service Principal ID(GUID). +# CLI flag: -.azure.client-id +[client_id: | default = ""] + +# Azure Service Principal secret key. +# CLI flag: -.azure.client-secret +[client_secret: | default = ""] + +# Azure Tenant ID is used to authenticate through Azure OAuth. +# CLI flag: -.azure.tenant-id +[tenant_id: | default = ""] + +# Chunk delimiter for blob ID to be used +# CLI flag: -.azure.chunk-delimiter +[chunk_delimiter: | default = "-"] + +# Preallocated buffer size for downloads. +# CLI flag: -.azure.download-buffer-size +[download_buffer_size: | default = 512000] + +# Preallocated buffer size for uploads. +# CLI flag: -.azure.upload-buffer-size +[upload_buffer_size: | default = 256000] + +# Number of buffers used to used to upload a chunk. +# CLI flag: -.azure.download-buffer-count +[upload_buffer_count: | default = 1] + +# Timeout for requests made against azure blob storage. +# CLI flag: -.azure.request-timeout +[request_timeout: | default = 30s] + +# Number of retries for a request which times out. +# CLI flag: -.azure.max-retries +[max_retries: | default = 5] + +# Minimum time to wait before retrying a request. +# CLI flag: -.azure.min-retry-delay +[min_retry_delay: | default = 10ms] + +# Maximum time to wait before retrying a request. +# CLI flag: -.azure.max-retry-delay +[max_retry_delay: | default = 500ms] ``` -Example runtime configuration file: +### gcs_storage_config + +The `gcs_storage_config` block configures the connection to Google Cloud Storage object storage backend. The supported CLI flags `` used to reference this configuration block are: + +- `common.storage` +- `ruler.storage` + +  ```yaml -overrides: - tenant1: - ingestion_rate_mb: 10 - max_streams_per_user: 100000 - max_chunks_per_query: 100000 - tenant2: - max_streams_per_user: 1000000 - max_chunks_per_query: 1000000 - -multi_kv_config: - mirror-enabled: false - primary: consul +# Name of GCS bucket. Please refer to +# https://cloud.google.com/docs/authentication/production for more information +# about how to configure authentication. +# CLI flag: -.gcs.bucketname +[bucket_name: | default = ""] + +# Service account key content in JSON format, refer to +# https://cloud.google.com/iam/docs/creating-managing-service-account-keys for +# creation. +# CLI flag: -.gcs.service-account +[service_account: | default = ""] + +# The size of the buffer that GCS client for each PUT request. 0 to disable +# buffering. +# CLI flag: -.gcs.chunk-buffer-size +[chunk_buffer_size: | default = 0] + +# The duration after which the requests to GCS should be timed out. +# CLI flag: -.gcs.request-timeout +[request_timeout: | default = 0s] + +# Enable OpenCensus (OC) instrumentation for all requests. +# CLI flag: -.gcs.enable-opencensus +[enable_opencensus: | default = true] + +# Enable HTTP2 connections. +# CLI flag: -.gcs.enable-http2 +[enable_http2: | default = true] ``` -## Accept out-of-order writes +### s3_storage_config -Since the beginning of Loki, log entries had to be written to Loki in order -by time. -This limitation has been lifted. -Out-of-order writes are enabled globally by default, but can be disabled/enabled -on a cluster or per-tenant basis. +The `s3_storage_config` block configures the connection to Amazon S3 object storage backend. The supported CLI flags `` used to reference this configuration block are: -- To disable out-of-order writes for all tenants, -place in the `limits_config` section: +- `common` +- `ruler` - ``` - limits_config: - unordered_writes: false - ``` +  -- To disable out-of-order writes for specific tenants, -configure a runtime configuration file: +```yaml +# S3 endpoint URL with escaped Key and Secret encoded. If only region is +# specified as a host, proper endpoint will be deduced. Use +# inmemory:/// to use a mock in-memory implementation. +# CLI flag: -.storage.s3.url +[s3: ] - ``` - runtime_config: overrides.yaml - ``` +# Set this to `true` to force the request to use path-style addressing. +# CLI flag: -.storage.s3.force-path-style +[s3forcepathstyle: | default = false] + +# Comma separated list of bucket names to evenly distribute chunks over. +# Overrides any buckets specified in s3.url flag +# CLI flag: -.storage.s3.buckets +[bucketnames: | default = ""] + +# S3 Endpoint to connect to. +# CLI flag: -.storage.s3.endpoint +[endpoint: | default = ""] - In the `overrides.yaml` file, add `unordered_writes` for each tenant - permitted to have out-of-order writes: +# AWS region to use. +# CLI flag: -.storage.s3.region +[region: | default = ""] + +# AWS Access Key ID +# CLI flag: -.storage.s3.access-key-id +[access_key_id: | default = ""] + +# AWS Secret Access Key +# CLI flag: -.storage.s3.secret-access-key +[secret_access_key: | default = ""] + +# Disable https on s3 connection. +# CLI flag: -.storage.s3.insecure +[insecure: | default = false] + +# Enable AWS Server Side Encryption [Deprecated: Use .sse instead. if +# s3.sse-encryption is enabled, it assumes .sse.type SSE-S3] +# CLI flag: -.storage.s3.sse-encryption +[sse_encryption: | default = false] + +http_config: + # The maximum amount of time an idle connection will be held open. + # CLI flag: -.storage.s3.http.idle-conn-timeout + [idle_conn_timeout: | default = 1m30s] + + # If non-zero, specifies the amount of time to wait for a server's response + # headers after fully writing the request. + # CLI flag: -.storage.s3.http.response-header-timeout + [response_header_timeout: | default = 0s] + + # Set to true to skip verifying the certificate chain and hostname. + # CLI flag: -.storage.s3.http.insecure-skip-verify + [insecure_skip_verify: | default = false] + + # Path to the trusted CA file that signed the SSL certificate of the S3 + # endpoint. + # CLI flag: -.storage.s3.http.ca-file + [ca_file: | default = ""] + +# The signature version to use for authenticating against S3. Supported values +# are: v4, v2. +# CLI flag: -.storage.s3.signature-version +[signature_version: | default = "v4"] + +sse: + # Enable AWS Server Side Encryption. Supported values: SSE-KMS, SSE-S3. + # CLI flag: -.storage.s3.sse.type + [type: | default = ""] + + # KMS Key ID used to encrypt objects in S3 + # CLI flag: -.storage.s3.sse.kms-key-id + [kms_key_id: | default = ""] + + # KMS Encryption Context used for object encryption. It expects JSON formatted + # string. + # CLI flag: -.storage.s3.sse.kms-encryption-context + [kms_encryption_context: | default = ""] + +# Configures back off when S3 get Object. +backoff_config: + # Minimum backoff time when s3 get Object + # CLI flag: -.storage.s3.min-backoff + [min_period: | default = 100ms] + + # Maximum backoff time when s3 get Object + # CLI flag: -.storage.s3.max-backoff + [max_period: | default = 3s] + + # Maximum number of times to retry when s3 get Object + # CLI flag: -.storage.s3.max-retries + [max_retries: | default = 5] +``` + +### bos_storage_config + +The `bos_storage_config` block configures the connection to Baidu Object Storage (BOS) object storage backend. The supported CLI flags `` used to reference this configuration block are: + +- `common.storage` +- `ruler.storage` + +  + +```yaml +# Name of BOS bucket. +# CLI flag: -.bos.bucket-name +[bucket_name: | default = ""] - ``` - overrides: - "tenantA": - unordered_writes: false - ``` +# BOS endpoint to connect to. +# CLI flag: -.bos.endpoint +[endpoint: | default = "bj.bcebos.com"] -How far into the past accepted out-of-order log entries may be -is configurable with `max_chunk_age`. -`max_chunk_age` defaults to 2 hour. -Loki calculates the earliest time that out-of-order entries may have -and be accepted with +# Baidu Cloud Engine (BCE) Access Key ID. +# CLI flag: -.bos.access-key-id +[access_key_id: | default = ""] +# Baidu Cloud Engine (BCE) Secret Access Key. +# CLI flag: -.bos.secret-access-key +[secret_access_key: | default = ""] ``` -time_of_most_recent_line - (max_chunk_age/2) + +### swift_storage_config + +The `swift_storage_config` block configures the connection to OpenStack Object Storage (Swift) object storage backend. The supported CLI flags `` used to reference this configuration block are: + +- `common.storage` +- `ruler.storage` + +  + +```yaml +# OpenStack Swift authentication API version. 0 to autodetect. +# CLI flag: -.swift.auth-version +[auth_version: | default = 0] + +# OpenStack Swift authentication URL +# CLI flag: -.swift.auth-url +[auth_url: | default = ""] + +# OpenStack Swift username. +# CLI flag: -.swift.username +[username: | default = ""] + +# OpenStack Swift user's domain name. +# CLI flag: -.swift.user-domain-name +[user_domain_name: | default = ""] + +# OpenStack Swift user's domain ID. +# CLI flag: -.swift.user-domain-id +[user_domain_id: | default = ""] + +# OpenStack Swift user ID. +# CLI flag: -.swift.user-id +[user_id: | default = ""] + +# OpenStack Swift API key. +# CLI flag: -.swift.password +[password: | default = ""] + +# OpenStack Swift user's domain ID. +# CLI flag: -.swift.domain-id +[domain_id: | default = ""] + +# OpenStack Swift user's domain name. +# CLI flag: -.swift.domain-name +[domain_name: | default = ""] + +# OpenStack Swift project ID (v2,v3 auth only). +# CLI flag: -.swift.project-id +[project_id: | default = ""] + +# OpenStack Swift project name (v2,v3 auth only). +# CLI flag: -.swift.project-name +[project_name: | default = ""] + +# ID of the OpenStack Swift project's domain (v3 auth only), only needed if it +# differs the from user domain. +# CLI flag: -.swift.project-domain-id +[project_domain_id: | default = ""] + +# Name of the OpenStack Swift project's domain (v3 auth only), only needed if it +# differs from the user domain. +# CLI flag: -.swift.project-domain-name +[project_domain_name: | default = ""] + +# OpenStack Swift Region to use (v2,v3 auth only). +# CLI flag: -.swift.region-name +[region_name: | default = ""] + +# Name of the OpenStack Swift container to put chunks in. +# CLI flag: -.swift.container-name +[container_name: | default = ""] + +# Max retries on requests error. +# CLI flag: -.swift.max-retries +[max_retries: | default = 3] + +# Time after which a connection attempt is aborted. +# CLI flag: -.swift.connect-timeout +[connect_timeout: | default = 10s] + +# Time after which an idle request is aborted. The timeout watchdog is reset +# each time some data is received, so the timeout triggers after X time no data +# is received on a request. +# CLI flag: -.swift.request-timeout +[request_timeout: | default = 5s] ``` -Log entries with timestamps that are after this earliest time are accepted. -Log entries further back in time return an out-of-order error. +### local_storage_config + +The `local_storage_config` block configures the usage of local file system as object storage backend. -For example, if `max_chunk_age` is 2 hours -and the stream `{foo="bar"}` has one entry at `8:00`, -Loki will accept data for that stream as far back in time as `7:00`. -If another log line is written at `10:00`, -Loki will accept data for that stream as far back in time as `9:00`. +```yaml +# Directory to scan for rules +# CLI flag: -ruler.storage.local.directory +[directory: | default = ""] +``` \ No newline at end of file diff --git a/docs/sources/configuration/index.template b/docs/sources/configuration/index.template new file mode 100644 index 0000000000000..89cabcbdec8f4 --- /dev/null +++ b/docs/sources/configuration/index.template @@ -0,0 +1,98 @@ +--- +description: Describes parameters used to configure Grafana Loki. +menuTitle: Configuration parameters +title: Grafana Loki configuration parameters +weight: 500 +--- + +# Grafana Loki configuration parameters + +{{ .GeneratedFileWarning }} + +Grafana Loki is configured in a YAML file (usually referred to as `loki.yaml` ) +which contains information on the Loki server and its individual components, +depending on which mode Loki is launched in. + +Configuration examples can be found in the [Configuration Examples](examples/) document. + +## Printing Loki config at runtime + +If you pass Loki the flag `-print-config-stderr` or `-log-config-reverse-order`, (or `-print-config-stderr=true`) +Loki will dump the entire config object it has created from the built-in defaults combined first with +overrides from config file, and second by overrides from flags. + +The result is the value for every config object in the Loki config struct, which is very large... + +Many values will not be relevant to your install such as storage configs which you are not using and which you did not define, +this is expected as every option has a default value if it is being used or not. + +This config is what Loki will use to run, it can be invaluable for debugging issues related to configuration and +is especially useful in making sure your config files and flags are being read and loaded properly. + +`-print-config-stderr` is nice when running Loki directly e.g. `./loki ` as you can get a quick output of the entire Loki config. + +`-log-config-reverse-order` is the flag we run Loki with in all our environments, the config entries are reversed so +that the order of configs reads correctly top to bottom when viewed in Grafana's Explore. + +## Reload at runtime + +Promtail can reload its configuration at runtime. If the new configuration +is not well-formed, the changes will not be applied. +A configuration reload is triggered by sending a `SIGHUP` to the Promtail process or +sending a HTTP POST request to the `/reload` endpoint (when the `--server.enable-runtime-reload` flag is enabled). + +## Configuration file reference + +To specify which configuration file to load, pass the `-config.file` flag at the +command line. The value can be a list of comma separated paths, then the first +file that exists will be used. +If no `-config.file` argument is specified, Loki will look up the `config.yaml` in the +current working directory and the `config/` subdirectory and try to use that. + +The file is written in [YAML +format](https://en.wikipedia.org/wiki/YAML), defined by the scheme below. +Brackets indicate that a parameter is optional. For non-list parameters the +value is set to the specified default. + +### Use environment variables in the configuration + +> **Note:** This feature is only available in Loki 2.1+. + +You can use environment variable references in the configuration file to set values that need to be configurable during deployment. +To do this, pass `-config.expand-env=true` and use: + +``` +${VAR} +``` + +Where VAR is the name of the environment variable. + +Each variable reference is replaced at startup by the value of the environment variable. +The replacement is case-sensitive and occurs before the YAML file is parsed. +References to undefined variables are replaced by empty strings unless you specify a default value or custom error text. + +To specify a default value, use: + +``` +${VAR:-default_value} +``` + +Where default_value is the value to use if the environment variable is undefined. + +Pass the `-config.expand-env` flag at the command line to enable this way of setting configs. + +### Generic placeholders + +- `` : a boolean that can take the values `true` or `false` +- `` : any integer matching the regular expression `[1-9]+[0-9]*` +- `` : a duration matching the regular expression `[0-9]+(ns|us|µs|ms|[smh])` +- `` : a string matching the regular expression `[a-zA-Z_][a-zA-Z0-9_]*` +- `` : a string of unicode characters +- `` : a valid path relative to current working directory or an absolute path. +- `` : a valid string consisting of a hostname or IP followed by an optional port number +- `` : a string +- `` : a string that represents a secret, such as a password + +### Supported contents and default values of `loki.yaml` + +{{ .ConfigFile }} \ No newline at end of file diff --git a/docs/sources/installation/docker.md b/docs/sources/installation/docker.md index c7c1f456f7e82..b22be133fc5d4 100644 --- a/docs/sources/installation/docker.md +++ b/docs/sources/installation/docker.md @@ -21,9 +21,9 @@ The configuration acquired with these installation instructions run Loki as a si Copy and paste the commands below into your command line. ```bash -wget https://raw.githubusercontent.com/grafana/loki/v2.6.1/cmd/loki/loki-local-config.yaml -O loki-config.yaml +wget https://raw.githubusercontent.com/grafana/loki/v2.7.1/cmd/loki/loki-local-config.yaml -O loki-config.yaml docker run --name loki -d -v $(pwd):/mnt/config -p 3100:3100 grafana/loki:2.6.1 -config.file=/mnt/config/loki-config.yaml -wget https://raw.githubusercontent.com/grafana/loki/v2.6.1/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml +wget https://raw.githubusercontent.com/grafana/loki/v2.7.1/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml docker run --name promtail -d -v $(pwd):/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.6.1 -config.file=/mnt/config/promtail-config.yaml ``` @@ -39,9 +39,9 @@ Copy and paste the commands below into your terminal. Note that you will need to ```bash cd "" -wget https://raw.githubusercontent.com/grafana/loki/v2.6.1/cmd/loki/loki-local-config.yaml -O loki-config.yaml +wget https://raw.githubusercontent.com/grafana/loki/v2.7.1/cmd/loki/loki-local-config.yaml -O loki-config.yaml docker run --name loki -v :/mnt/config -p 3100:3100 grafana/loki:2.6.1 --config.file=/mnt/config/loki-config.yaml -wget https://raw.githubusercontent.com/grafana/loki/v2.6.1/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml +wget https://raw.githubusercontent.com/grafana/loki/v2.7.1/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml docker run -v :/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.6.1 --config.file=/mnt/config/promtail-config.yaml ``` @@ -54,6 +54,6 @@ Navigate to http://localhost:3100/metrics to view the output. Run the following commands in your command line. They work for Windows or Linux systems. ```bash -wget https://raw.githubusercontent.com/grafana/loki/v2.6.1/production/docker-compose.yaml -O docker-compose.yaml +wget https://raw.githubusercontent.com/grafana/loki/v2.7.1/production/docker-compose.yaml -O docker-compose.yaml docker-compose -f docker-compose.yaml up ``` diff --git a/docs/sources/installation/helm/concepts.md b/docs/sources/installation/helm/concepts.md index c4d2adf7e7ad0..9a2191640ddae 100644 --- a/docs/sources/installation/helm/concepts.md +++ b/docs/sources/installation/helm/concepts.md @@ -25,7 +25,7 @@ This chart includes dashboards for monitoring Loki. These require the scrape con ## Canary -This chart installs the [canary](../../../operations/loki-canary) and its alerts by default. This is another tool to verify the Loki deployment is in a healthy state. It can be disabled with `monitoring.selfMonitoring.lokiCanary.enabled=false`. +This chart installs the [canary](../../../operations/loki-canary) and its alerts by default. This is another tool to verify the Loki deployment is in a healthy state. It can be disabled with `monitoring.lokiCanary.enabled=false`. ## Gateway diff --git a/docs/sources/installation/helm/generate/index.md b/docs/sources/installation/helm/generate/index.md deleted file mode 100644 index dd4cd8c48d86c..0000000000000 --- a/docs/sources/installation/helm/generate/index.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: Generate Helm Chart Values -menuTitle: Generate Helm Chart Values -description: A sizing tool that generates Helm Chart values. -aliases: - - /docs/installation/helm/generate -weight: 100 -keywords: [] ---- - - - -# Generate Helm Chart Values - - - -This tool helps to generate a Helm Charts `values.yaml` file based on specified - expected ingestion, retention rate and node type. - -
- - - - - - - - - - - -
- - - - -
- - -
- - - - diff --git a/docs/sources/installation/helm/install-monolithic/index.md b/docs/sources/installation/helm/install-monolithic/index.md index 6f69118580379..eb098798bc3d3 100644 --- a/docs/sources/installation/helm/install-monolithic/index.md +++ b/docs/sources/installation/helm/install-monolithic/index.md @@ -12,7 +12,7 @@ keywords: [] This Helm Chart installation runs the Grafana Loki *single binary* within a Kubernetes cluster. -If the filesyste is set to `filesystem`, this chart configures Loki to run the `all` target in a [monolothic](../../fundamentals/architecture/deployment-modes/#monolithic-mode), designed to work with a filesystem storage. It will also configure meta-monitoring of metrics and logs. +If the filesystem is set to `filesystem`, this chart configures Loki to run the `all` target in a [monolithic mode](../../../../fundamentals/architecture/deployment-modes/#monolithic-mode), designed to work with a filesystem storage. It will also configure meta-monitoring of metrics and logs. It is not possible to install the single binary with a different storage type. diff --git a/docs/sources/installation/helm/install-scalable/index.md b/docs/sources/installation/helm/install-scalable/index.md index 72eef74972a15..8f174a9aa939b 100644 --- a/docs/sources/installation/helm/install-scalable/index.md +++ b/docs/sources/installation/helm/install-scalable/index.md @@ -14,7 +14,7 @@ keywords: [] This Helm Chart installation runs the Grafana Loki cluster within a Kubernetes cluster. -If object storge is configured, this chart configures Loki to run `read` and `write` targets in a [scalable](../../fundamentals/architecture/deployment-modes/#simple-scalable-deployment-mode), highly available architecture (3 replicas of each) designed to work with AWS S3 object storage. It will also configure meta-monitoring of metrics and logs. +If object storage is configured, this chart configures Loki to run `read` and `write` targets in a [scalable]({{< relref "../../../fundamentals/architecture/deployment-modes#simple-scalable-deployment-mode" >}}), highly available architecture (3 replicas of each) designed to work with AWS S3 object storage. It will also configure meta-monitoring of metrics and logs. It is not possible to run the scalable mode with the `filesystem` storage. @@ -50,7 +50,6 @@ It is not possible to run the scalable mode with the `filesystem` storage. admin: admin type: s3 s3: - s3: endpoint: region: secretAccessKey: diff --git a/docs/sources/installation/helm/monitor-and-alert/index.md b/docs/sources/installation/helm/monitor-and-alert/index.md index cde667a0e4e3a..c33082133acbc 100644 --- a/docs/sources/installation/helm/monitor-and-alert/index.md +++ b/docs/sources/installation/helm/monitor-and-alert/index.md @@ -119,8 +119,6 @@ Rules and alerts are automatically deployed. ... selfMonitoring: enabled: true - lokiCanary: - enabled: false logsInstance: clients: - url: @@ -130,7 +128,9 @@ Rules and alerts are automatically deployed. key: username password: name: primary-credentials-logs - key: password + key: password + lokiCanary: + enabled: false ``` 5. Install the `Loki meta-motoring` connection on Grafana Cloud. diff --git a/docs/sources/installation/helm/reference.md b/docs/sources/installation/helm/reference.md index 9c97481811dd0..de3d88759f76b 100644 --- a/docs/sources/installation/helm/reference.md +++ b/docs/sources/installation/helm/reference.md @@ -757,6 +757,15 @@ false } ] + + + + gateway.lifecycle + object + Lifecycle for the gateway container +
+{}
+
@@ -1730,268 +1739,268 @@ null - monitoring.rules.additionalGroups - list - Additional groups to add to the rules file + monitoring.lokiCanary.annotations + object + Additional annotations for the `loki-canary` Daemonset
-[]
+{}
 
- monitoring.rules.alerting + monitoring.lokiCanary.enabled bool - Include alerting rules +
 true
 
- monitoring.rules.annotations - object - Additional annotations for the rules PrometheusRule resource + monitoring.lokiCanary.extraArgs + list + Additional CLI arguments for the `loki-canary' command
-{}
+[]
 
- monitoring.rules.enabled - bool - If enabled, create PrometheusRule resource with Loki recording rules + monitoring.lokiCanary.extraEnv + list + Environment variables to add to the canary pods
-true
+[]
 
- monitoring.rules.labels - object - Additional labels for the rules PrometheusRule resource + monitoring.lokiCanary.extraEnvFrom + list + Environment variables from secrets or configmaps to add to the canary pods
-{}
+[]
 
- monitoring.rules.namespace - string - Alternative namespace to create recording rules PrometheusRule resource in + monitoring.lokiCanary.image + object + Image to use for loki canary
-null
+{
+  "pullPolicy": "IfNotPresent",
+  "registry": "docker.io",
+  "repository": "grafana/loki-canary",
+  "tag": null
+}
 
- monitoring.selfMonitoring.enabled - bool - + monitoring.lokiCanary.image.pullPolicy + string + Docker image pull policy
-true
+"IfNotPresent"
 
- monitoring.selfMonitoring.grafanaAgent.annotations - object - Grafana Agent annotations + monitoring.lokiCanary.image.registry + string + The Docker registry
-{}
+"docker.io"
 
- monitoring.selfMonitoring.grafanaAgent.enableConfigReadAPI - bool - Enable the config read api on port 8080 of the agent + monitoring.lokiCanary.image.repository + string + Docker image repository
-false
+"grafana/loki-canary"
 
- monitoring.selfMonitoring.grafanaAgent.installOperator - bool - Controls whether to install the Grafana Agent Operator and its CRDs. Note that helm will not install CRDs if this flag is enabled during an upgrade. In that case install the CRDs manually from https://github.com/grafana/agent/tree/main/production/operator/crds + monitoring.lokiCanary.image.tag + string + Overrides the image tag whose default is the chart's appVersion
-true
+null
 
- monitoring.selfMonitoring.grafanaAgent.labels + monitoring.lokiCanary.nodeSelector object - Additional Grafana Agent labels + Node selector for canary pods
 {}
 
- monitoring.selfMonitoring.grafanaAgent.namespace - string - Alternative namespace for Grafana Agent resources -
-null
-
- - - - monitoring.selfMonitoring.logsInstance.annotations + monitoring.lokiCanary.resources object - LogsInstance annotations + Resource requests and limits for the canary
 {}
 
- monitoring.selfMonitoring.logsInstance.clients - string - Additional clients for remote write + monitoring.lokiCanary.tolerations + list + Tolerations for canary pods
-null
+[]
 
- monitoring.selfMonitoring.logsInstance.labels - object - Additional LogsInstance labels + monitoring.rules.additionalGroups + list + Additional groups to add to the rules file
-{}
+[]
 
- monitoring.selfMonitoring.logsInstance.namespace - string - Alternative namespace for LogsInstance resources + monitoring.rules.alerting + bool + Include alerting rules
-null
+true
 
- monitoring.selfMonitoring.lokiCanary.annotations + monitoring.rules.annotations object - Additional annotations for the `loki-canary` Daemonset + Additional annotations for the rules PrometheusRule resource
 {}
 
- monitoring.selfMonitoring.lokiCanary.enabled + monitoring.rules.enabled bool - + If enabled, create PrometheusRule resource with Loki recording rules
 true
 
- monitoring.selfMonitoring.lokiCanary.extraArgs - list - Additional CLI arguments for the `loki-canary' command + monitoring.rules.labels + object + Additional labels for the rules PrometheusRule resource
-[]
+{}
 
- monitoring.selfMonitoring.lokiCanary.extraEnv - list - Environment variables to add to the canary pods + monitoring.rules.namespace + string + Alternative namespace to create recording rules PrometheusRule resource in
-[]
+null
 
- monitoring.selfMonitoring.lokiCanary.extraEnvFrom - list - Environment variables from secrets or configmaps to add to the canary pods + monitoring.selfMonitoring.enabled + bool +
-[]
+true
 
- monitoring.selfMonitoring.lokiCanary.image + monitoring.selfMonitoring.grafanaAgent.annotations object - Image to use for loki canary + Grafana Agent annotations
-{
-  "pullPolicy": "IfNotPresent",
-  "registry": "docker.io",
-  "repository": "grafana/loki-canary",
-  "tag": null
-}
+{}
 
- monitoring.selfMonitoring.lokiCanary.image.pullPolicy - string - Docker image pull policy + monitoring.selfMonitoring.grafanaAgent.enableConfigReadAPI + bool + Enable the config read api on port 8080 of the agent
-"IfNotPresent"
+false
 
- monitoring.selfMonitoring.lokiCanary.image.registry - string - The Docker registry + monitoring.selfMonitoring.grafanaAgent.installOperator + bool + Controls whether to install the Grafana Agent Operator and its CRDs. Note that helm will not install CRDs if this flag is enabled during an upgrade. In that case install the CRDs manually from https://github.com/grafana/agent/tree/main/production/operator/crds
-"docker.io"
+true
 
- monitoring.selfMonitoring.lokiCanary.image.repository - string - Docker image repository + monitoring.selfMonitoring.grafanaAgent.labels + object + Additional Grafana Agent labels
-"grafana/loki-canary"
+{}
 
- monitoring.selfMonitoring.lokiCanary.image.tag + monitoring.selfMonitoring.grafanaAgent.namespace string - Overrides the image tag whose default is the chart's appVersion + Alternative namespace for Grafana Agent resources
 null
 
- monitoring.selfMonitoring.lokiCanary.nodeSelector + monitoring.selfMonitoring.logsInstance.annotations object - Node selector for canary pods + LogsInstance annotations
 {}
 
- monitoring.selfMonitoring.lokiCanary.resources + monitoring.selfMonitoring.logsInstance.clients + string + Additional clients for remote write +
+null
+
+ + + + monitoring.selfMonitoring.logsInstance.labels object - Resource requests and limits for the canary + Additional LogsInstance labels
 {}
 
- monitoring.selfMonitoring.lokiCanary.tolerations - list - Tolerations for canary pods + monitoring.selfMonitoring.logsInstance.namespace + string + Alternative namespace for LogsInstance resources
-[]
+null
 
@@ -2457,6 +2466,15 @@ null
 null
 
+ + + + read.lifecycle + object + Lifecycle for the read container +
+{}
+
@@ -3059,6 +3077,15 @@ null
 null
 
+ + + + write.lifecycle + object + Lifecycle for the write container +
+{}
+
diff --git a/docs/sources/installation/sizing/index.md b/docs/sources/installation/sizing/index.md index fe88f268d2094..3c1657ecae893 100644 --- a/docs/sources/installation/sizing/index.md +++ b/docs/sources/installation/sizing/index.md @@ -19,18 +19,18 @@ This tool helps to generate a Helm Charts `values.yaml` file based on specified
- + - + - + - +
Generate and download values file + +
+ + Defines the log volume in terrabytes expected to be ingested each day. + + + Defines the node type of the Kubernetes cluster. + + + Defines how long the ingested logs should be kept. + + + Defines the expected query performance. Basic enables 3mbps. Super should be chosen if more query throughput is required. + +
- -