安装minio
请参考minio官方文档部署
创建Buckets
配置Policy策略
创建一个loki的policy,授权内容如下 (权限配置请参考aws的s3权限配置)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::loki/*", "arn:aws:s3:::loki" ] } ] } |
注意:Resource字段配置,配置请参考https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-arn-format.html
配置minio用户
新建用户loki并将前面创建的policy授权
Loki运行配置文件参考
可以参考loki官方文档https://grafana.com/docs/loki/latest/configuration/examples/
# This is a configuration to deploy Loki depending only on a storage solution # for example, an S3-compatible API like MinIO. # The ring configuration is based on the gossip memberlist and the index is shipped to storage # via Single Store (boltdb-shipper) auth_enabled: false server: http_listen_port: 3100 #distributor: # ring: # kvstore: # store: memberlist ingester: lifecycler: ring: kvstore: store: inmemory replication_factor: 1 final_sleep: 0s chunk_idle_period: 5m chunk_retain_period: 30s #memberlist: # abort_if_cluster_join_fails: false # # # Expose this port on all distributor, ingester # # and querier replicas. # bind_port: 7946 # # # You can use a headless k8s service for all distributor, # # ingester and querier components. # join_members: # - loki-gossip-ring.loki.svc.cluster.local:7946 # # max_join_backoff: 1m # max_join_retries: 10 # min_join_backoff: 1s schema_config: configs: - from: 2022-11-09 store: boltdb-shipper object_store: s3 schema: v11 index: prefix: index_ period: 24h storage_config: boltdb_shipper: active_index_directory: /loki/index cache_location: /loki/index_cache shared_store: s3 aws: s3: s3://loki:password@192.168.1.1:9000/loki s3forcepathstyle: true limits_config: enforce_metric_name: false reject_old_samples: true reject_old_samples_max_age: 168h retention_period: 1d compactor: working_directory: /loki/compactor shared_store: s3 compaction_interval: 1m retention_enabled: true |
注意:标红周期必须为24小时