欢迎阅读!

潇湘夜雨

当前位置: 主页 > 系统 > 云计算与云原生 >

loki日志保留策略配置

时间:2025-10-11 19:08来源:未知 作者:liangzh 点击:
1、修改配置 limits_config: retention_period: 744h retention_stream: - selector: {container=tempo} #按日志标签匹配 priority: 1 period: 168h - selector: {container=application-controller} priority: 1 period: 150h #retention_deletes
1、修改配置

limits_config:
  retention_period: 744h
  retention_stream:
  - selector: '{container="tempo"}' #按日志标签匹配
    priority: 1
    period: 168h
  - selector: '{container="application-controller"}'
    priority: 1
    period: 150h
 
#retention_deletes_enabled: true 新版本已弃用,默认false,可以不用配置
 
 
compactor:
  working_directory: /var/loki/compactor
  compaction_interval: 1m
  retention_enabled: true
  retention_delete_delay: 1m
  retention_delete_worker_count: 150
  delete_request_store: s3

2、重启compactor服务

如果没有compator,可以ingester服务的启动命令添加compactor
loki:
  compactor:
    enabled: true
 
    extraArgs:
      - -compactor.working-directory=/loki/compactor
3、常见错误

Loki compactor err="open /tmp/marker-view-3955168416: read-only file system
解决方法1:关闭tmp目录的只读限制
compactor:
  securityContext:
    readOnlyRootFilesystem: false
解决方法2:在helm的value文件配置tmp的临时卷
  extraVolumes:
    - name: tmp
      emptyDir: {}
  extraVolumeMounts:
    - name: tmp
      mountPath: /tmp

(责任编辑:liangzh)
织梦二维码生成器
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------