From 46d643783565fa2915f8a1feb7cf0bddaf9ea118 Mon Sep 17 00:00:00 2001 From: Edward Welch Date: Thu, 4 Apr 2024 21:11:38 +0000 Subject: [PATCH] update config examples Signed-off-by: Edward Welch --- .../examples/configuration-examples.md | 400 ++++++++++++++++++ 1 file changed, 400 insertions(+) diff --git a/docs/sources/configure/examples/configuration-examples.md b/docs/sources/configure/examples/configuration-examples.md index da9307c30be6..76b5ffc7a719 100644 --- a/docs/sources/configure/examples/configuration-examples.md +++ b/docs/sources/configure/examples/configuration-examples.md @@ -4,3 +4,403 @@ description: Loki Configuration Examples and Snippets weight: 100 --- # Configuration + +## 1-Local-Configuration-Example.yaml + +```yaml + +# This is a complete configuration to deploy Loki backed by the filesystem. +# The index will be shipped to the storage via tsdb-shipper. + +auth_enabled: false + +server: + http_listen_port: 3100 + +common: + ring: + instance_addr: 127.0.0.1 + kvstore: + store: inmemory + replication_factor: 1 + path_prefix: /tmp/loki + +schema_config: + configs: + - from: 2020-05-15 + store: tsdb + object_store: filesystem + schema: v13 + index: + prefix: index_ + period: 24h + +storage_config: + tsdb_shipper: + active_index_directory: /tmp/loki/index + cache_location: /tmp/loki/index_cache + filesystem: + directory: /tmp/loki/chunks + +``` + + +## 2-S3-Cluster-Example.yaml + +```yaml + +# This is a complete configuration to deploy Loki backed by a s3-compatible API +# like MinIO for storage. +# Index files will be written locally at /loki/index and, eventually, will be shipped to the storage via tsdb-shipper. + +auth_enabled: false + +server: + http_listen_port: 3100 + +common: + ring: + instance_addr: 127.0.0.1 + kvstore: + store: inmemory + replication_factor: 1 + path_prefix: /loki + +schema_config: + configs: + - from: 2020-05-15 + store: tsdb + object_store: s3 + schema: v13 + index: + prefix: index_ + period: 24h + +storage_config: + tsdb_shipper: + active_index_directory: /loki/index + cache_location: /loki/index_cache + aws: + s3: s3://access_key:secret_access_key@custom_endpoint/bucket_name + s3forcepathstyle: true + +``` + + +## 3-S3-Without-Credentials-Snippet.yaml + +```yaml + +# If you don't wish to hard-code S3 credentials you can also configure an EC2 +# instance role by changing the `storage_config` section. + +storage_config: + aws: + s3: s3://region/bucket_name + + +``` + + +## 4-GCS-Example.yaml + +```yaml + +# This is a complete configuration to deploy Loki backed by a GCS. +# Index files will be written locally at /loki/index and, eventually, will be shipped to the storage via tsdb-shipper. + +auth_enabled: false + +server: + http_listen_port: 3100 + +common: + ring: + instance_addr: 127.0.0.1 + kvstore: + store: inmemory + replication_factor: 1 + path_prefix: /loki + +schema_config: + configs: + - from: 2020-05-15 + store: tsdb + object_store: gcs + schema: v13 + index: + prefix: index_ + period: 24h + +storage_config: + tsdb_shipper: + active_index_directory: /loki/index + cache_location: /loki/index_cache + gcs: + bucket_name: replace_by_your_bucked_name + +``` + + +## 5-BOS-Example.yaml + +```yaml + +# This is a partial configuration to deploy Loki backed by Baidu Object Storage (BOS). +# The index will be shipped to the storage via tsdb-shipper. + +schema_config: + configs: + - from: 2020-05-15 + store: tsdb + object_store: bos + schema: v13 + index: + prefix: index_ + period: 24h + +storage_config: + tsdb_shipper: + active_index_directory: /loki/index + cache_location: /loki/index_cache + bos: + bucket_name: bucket_name_1 + endpoint: bj.bcebos.com + access_key_id: access_key_id + secret_access_key: secret_access_key + +``` + + +## 6-Compactor-Snippet.yaml + +```yaml + +# This partial configuration sets the compactor to use S3 and run the compaction every 5 minutes. +# Downloaded index files for compaction are stored in /loki/compactor. + +compactor: + working_directory: /tmp/loki/compactor + compaction_interval: 5m + +``` + + +## 7-Schema-Migration-Snippet.yaml + +```yaml + +schema_config: + configs: + # Starting from 2018-04-15 Loki should store indexes on BoltDB with the v11 schema + # using daily periodic tables and chunks on filesystem. + # The index tables will be prefixed with "index_". + - from: "2018-04-15" + store: boltdb-shipper + object_store: filesystem + schema: v11 + index: + period: 24h + prefix: index_ + + # Starting from 2023-6-15 Loki should store indexes on TSDB with the v13 schema + # using daily periodic tables and chunks on AWS S3. + - from: "2023-06-15" + store: tsdb + object_store: s3 + schema: v13 + index: + period: 24h + prefix: index_ + +``` + + +## 8-alibaba-cloud-storage-Snippet.yaml + +```yaml + +# This partial configuration uses Alibaba for chunk storage. + +schema_config: + configs: + - from: 2020-05-15 + store: tsdb + object_store: alibabacloud + schema: v13 + index: + prefix: index_ + period: 24h + +storage_config: + tsdb_shipper: + active_index_directory: /loki/index + cache_location: /loki/index_cache + alibabacloud: + bucket: + endpoint: + access_key_id: + secret_access_key: + +``` + + +## 9-S3-With-SSE-KMS-Snippet.yaml + +```yaml + +# This partial configuration uses S3 for chunk storage and a KMS CMK for encryption. + +storage_config: + aws: + s3: s3://access_key:secret_access_key@region/bucket_name + sse: + type: SSE-KMS + kms_key_id: 1234abcd-12ab-34cd-56ef-1234567890ab + +``` + + +## 10-Expanded-S3-Snippet.yaml + +```yaml + +# S3 configuration supports an expanded configuration. +# Either an `s3` endpoint URL can be used, or an expanded configuration can be used. + +storage_config: + aws: + bucketnames: bucket_name1, bucket_name2 + endpoint: s3.endpoint.com + region: s3_region + access_key_id: s3_access_key_id + secret_access_key: s3_secret_access_key + insecure: false + http_config: + idle_conn_timeout: 90s + response_header_timeout: 0s + insecure_skip_verify: false + s3forcepathstyle: true + + +``` + + +## 11-COS-HMAC-Example.yaml + +```yaml + +# This partial configuration uses IBM Cloud Object Storage (COS) for chunk storage. HMAC will be used for authenticating with COS. + +schema_config: + configs: + - from: 2020-10-01 + store: tsdb + object_store: cos + schema: v13 + index: + period: 24h + prefix: index_ + +storage_config: + tsdb_shipper: + active_index_directory: /loki/index + cache_location: /loki/index_cache + cos: + bucketnames: + endpoint: + region: + access_key_id: + secret_access_key: + +``` + + +## 12-COS-APIKey-Example.yaml + +```yaml + +# This partial configuration uses IBM Cloud Object Storage (COS) for chunk storage. APIKey will be used for authenticating with COS. + +schema_config: + configs: + - from: 2020-10-01 + store: tsdb + object_store: cos + schema: v13 + index: + period: 24h + prefix: index_ + +storage_config: + tsdb_shipper: + active_index_directory: /loki/index + cache_location: /loki/index_cache + cos: + bucketnames: + endpoint: + region: + api_key: + service_instance_id: + auth_endpoint: + +``` + + +## 13-COS-Trusted-Profile-Example.yaml + +```yaml + +# This partial configuration uses IBM Cloud Object Storage (COS) for chunk storage. +# A trusted profile will be used for authenticating with COS. We can either pass +# the trusted profile name or trusted profile ID along with the compute resource token file. +# If we pass both trusted profile name and trusted profile ID it should be of +# the same trusted profile. +# In order to use trusted profile authentication we need to follow an additional step to create a trusted profile. +# For more details about creating a trusted profile, see https://cloud.ibm.com/docs/account?topic=account-create-trusted-profile&interface=ui. + +schema_config: + configs: + - from: 2020-10-01 + store: tsdb + object_store: cos + schema: v13 + index: + period: 24h + prefix: index_ + +storage_config: + tsdb_shipper: + active_index_directory: /loki/index + cache_location: /loki/index_cache + cos: + bucketnames: + endpoint: + region: + auth_endpoint: + cr_token_file_path: + trusted_profile_name: # You can also use trusted_profile_id instead of trusted_profile_name + +``` + + +## 15-Memberlist-Ring-Snippet.yaml + +```yaml + +# This partial configuration uses memberlist for the ring. + +common: + ring: + kvstore: + store: memberlist + replication_factor: 1 + path_prefix: /loki + +memberlist: + join_members: + # You can use a headless k8s service for all distributor, ingester and querier components. + - loki-gossip-ring.loki.svc.cluster.local:7946 # :7946 is the default memberlist port. + +``` +