github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/docs/sources/configuration/examples.md (about) 1 --- 2 title: Examples 3 --- 4 # Loki Configuration Examples 5 6 ## almost-zero-dependency.yaml 7 8 ```yaml 9 # This is a configuration to deploy Loki depending only on a storage solution 10 # for example, an S3-compatible API like MinIO. 11 # The ring configuration is based on the gossip memberlist and the index is shipped to storage 12 # via Single Store (boltdb-shipper) 13 14 auth_enabled: false 15 16 server: 17 http_listen_port: 3100 18 19 distributor: 20 ring: 21 kvstore: 22 store: memberlist 23 24 ingester: 25 lifecycler: 26 ring: 27 kvstore: 28 store: memberlist 29 replication_factor: 1 30 final_sleep: 0s 31 chunk_idle_period: 5m 32 chunk_retain_period: 30s 33 34 memberlist: 35 abort_if_cluster_join_fails: false 36 37 # Expose this port on all distributor, ingester 38 # and querier replicas. 39 bind_port: 7946 40 41 # You can use a headless k8s service for all distributor, 42 # ingester and querier components. 43 join_members: 44 - loki-gossip-ring.loki.svc.cluster.local:7946 45 46 max_join_backoff: 1m 47 max_join_retries: 10 48 min_join_backoff: 1s 49 50 schema_config: 51 configs: 52 - from: 2020-05-15 53 store: boltdb-shipper 54 object_store: s3 55 schema: v11 56 index: 57 prefix: index_ 58 period: 24h 59 60 storage_config: 61 boltdb_shipper: 62 active_index_directory: /loki/index 63 cache_location: /loki/index_cache 64 shared_store: s3 65 66 aws: 67 s3: s3://access_key:secret_access_key@custom_endpoint/bucket_name 68 s3forcepathstyle: true 69 70 limits_config: 71 enforce_metric_name: false 72 reject_old_samples: true 73 reject_old_samples_max_age: 168h 74 75 compactor: 76 working_directory: /data/compactor 77 shared_store: s3 78 compaction_interval: 5m 79 ``` 80 81 82 ## aws-basic-config-no-creds.yaml 83 84 ```yaml 85 # If you don't wish to hard-code S3 credentials you can also configure an EC2 86 # instance role by changing the `storage_config` section 87 88 schema_config: 89 configs: 90 - from: 2020-05-15 91 store: aws 92 object_store: s3 93 schema: v11 94 index: 95 prefix: loki_ 96 storage_config: 97 aws: 98 s3: s3://region/bucket_name 99 dynamodb: 100 dynamodb_url: dynamodb://region 101 102 ``` 103 104 105 ## aws-basic-config.yaml 106 107 ```yaml 108 # This partial configuration uses S3 for chunk storage and uses DynamoDB for index storage 109 110 schema_config: 111 configs: 112 - from: 2020-05-15 113 store: aws 114 object_store: s3 115 schema: v11 116 index: 117 prefix: loki_ 118 storage_config: 119 aws: 120 s3: s3://access_key:secret_access_key@region/bucket_name 121 dynamodb: 122 dynamodb_url: dynamodb://access_key:secret_access_key@region 123 124 ``` 125 126 127 ## bos-config.yaml 128 129 ```yaml 130 schema_config: 131 configs: 132 - from: 2020-05-15 133 store: boltdb-shipper 134 object_store: bos 135 schema: v11 136 index: 137 prefix: index_ 138 period: 24h 139 140 storage_config: 141 boltdb_shipper: 142 active_index_directory: /loki/index 143 cache_location: /loki/index_cache 144 shared_store: bos 145 146 bos: 147 bucket_name: bucket_name_1 148 endpoint: bj.bcebos.com 149 access_key_id: access_key_id 150 secret_access_key: secret_access_key 151 152 compactor: 153 working_directory: /tmp/loki/compactor 154 shared_store: bos 155 ``` 156 157 158 ## cassandra-index.yaml 159 160 ```yaml 161 # This is a partial config that uses the local filesystem for chunk storage and Cassandra for index storage 162 163 schema_config: 164 configs: 165 - from: 2020-05-15 166 store: cassandra 167 object_store: filesystem 168 schema: v11 169 index: 170 prefix: cassandra_table 171 period: 168h 172 173 storage_config: 174 cassandra: 175 username: cassandra 176 password: cassandra 177 addresses: 127.0.0.1 178 auth: true 179 keyspace: lokiindex 180 181 filesystem: 182 directory: /tmp/loki/chunks 183 184 ``` 185 186 187 ## complete-local-config.yaml 188 189 ```yaml 190 auth_enabled: false 191 192 server: 193 http_listen_port: 3100 194 195 ingester: 196 lifecycler: 197 address: 127.0.0.1 198 ring: 199 kvstore: 200 store: inmemory 201 replication_factor: 1 202 final_sleep: 0s 203 chunk_idle_period: 5m 204 chunk_retain_period: 30s 205 206 schema_config: 207 configs: 208 - from: 2020-05-15 209 store: boltdb 210 object_store: filesystem 211 schema: v11 212 index: 213 prefix: index_ 214 period: 168h 215 216 storage_config: 217 boltdb: 218 directory: /tmp/loki/index 219 220 filesystem: 221 directory: /tmp/loki/chunks 222 223 limits_config: 224 enforce_metric_name: false 225 reject_old_samples: true 226 reject_old_samples_max_age: 168h 227 ``` 228 229 230 ## example-schema-config.yaml 231 232 ```yaml 233 # Additional example schema configuration for Cassandra 234 235 schema_config: 236 configs: 237 # Starting from 2018-04-15 Loki should store indexes on Cassandra 238 # using weekly periodic tables and chunks on filesystem. 239 # The index tables will be prefixed with "index_". 240 - from: "2018-04-15" 241 store: cassandra 242 object_store: filesystem 243 schema: v11 244 index: 245 period: 168h 246 prefix: index_ 247 248 # Starting from 2020-6-15 we moved from filesystem to AWS S3 for storing the chunks. 249 - from: "2020-06-15" 250 store: cassandra 251 object_store: s3 252 schema: v11 253 index: 254 period: 168h 255 prefix: index_ 256 257 ``` 258 259 260 ## google-cloud-storage-config.yaml 261 262 ```yaml 263 # This partial configuration uses GCS for chunk storage and uses BigTable for index storage 264 265 schema_config: 266 configs: 267 - from: 2020-05-15 268 store: bigtable 269 object_store: gcs 270 schema: v11 271 index: 272 prefix: loki_index_ 273 period: 168h 274 275 storage_config: 276 bigtable: 277 instance: BIGTABLE_INSTANCE 278 project: BIGTABLE_PROJECT 279 gcs: 280 bucket_name: GCS_BUCKET_NAME 281 282 ``` 283 284 285 ## s3-compatible-apis.yaml 286 287 ```yaml 288 # S3-compatible APIs such as Ceph Object Storage with an S3-compatible API, can be used. 289 # If the API supports path-style URLs rather than virtual hosted bucket addressing, 290 # configure the URL in `storage_config` with the custom endpoint 291 292 schema_config: 293 configs: 294 - from: 2020-05-15 295 store: aws 296 object_store: s3 297 schema: v11 298 index: 299 prefix: loki_ 300 storage_config: 301 aws: 302 s3: s3://access_key:secret_access_key@region/bucket_name 303 dynamodb: 304 dynamodb_url: dynamodb://access_key:secret_access_key@region 305 306 ``` 307 308 309 ## s3-expanded-config.yaml 310 311 ```yaml 312 # S3 configuration supports an expanded configuration. 313 # Either an `s3` endpoint URL can be used, or an expanded configuration can be used. 314 315 schema_config: 316 configs: 317 - from: 2020-05-15 318 store: aws 319 object_store: s3 320 schema: v11 321 index: 322 prefix: loki_ 323 storage_config: 324 aws: 325 bucketnames: bucket_name1, bucket_name2 326 endpoint: s3.endpoint.com 327 region: s3_region 328 access_key_id: s3_access_key_id 329 secret_access_key: s3_secret_access_key 330 insecure: false 331 sse_encryption: false 332 http_config: 333 idle_conn_timeout: 90s 334 response_header_timeout: 0s 335 insecure_skip_verify: false 336 s3forcepathstyle: true 337 338 ``` 339