Skip to content

Commit

Permalink
perf: 容器化日志存储支持参数控制存储总量 TencentBlueKing#2655
Browse files Browse the repository at this point in the history
暴露配置参数
  • Loading branch information
jsonwan committed Jan 8, 2024
1 parent 0950c45 commit fb82373
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public LogClearScheduledTasks(LogClearByVolumeUsageProperties logClearByVolumeUs
/**
* 清理:每20分钟根据磁盘使用量清理一次日志文件
*/
@Scheduled(cron = "50 0/20 * * * ?")
@Scheduled(cron = "50 * * * * ?")
public void clearLogFileByVolumeUsage() {
if (clearLogFileByVolumeUsageTask == null) {
log.debug("clearLogFileByVolumeUsage not enabled, ignore clearLogFile");
Expand Down
16 changes: 16 additions & 0 deletions support-files/kubernetes/charts/bk-job/VALUES_LOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# chart values 更新日志

## 0.5.7
1. 增加日志留存配置

```yaml
# 日志留存配置
log:
# 服务后台日志保留的小时数,默认48小时(2天)
keepHours: 48
# 根据磁盘占用量自动清理后台日志相关配置
clearByVolumeUsage:
# 是否开启自动清理任务,默认开启
enabled: true
# 服务后台日志可使用的最大磁盘空间(超出后将清理最旧的日志文件),单位支持B、KB、MB、GB、TB、PB,默认40GB
maxVolume: 40GB
```
## 0.5.6
1. 增加消息通知中心配置
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,12 @@ data:
metrics:
tags:
application: ${spring.application.name}
log:
# 服务后台日志保留的小时数,默认48小时(2天)
keep-hours: {{ .Values.log.keepHours }}
# 根据磁盘占用量自动清理后台日志相关配置
clear-by-volume-usage:
# 是否开启自动清理任务,默认开启
enabled: {{ .Values.log.clearByVolumeUsage.enabled }}
# 服务后台日志可使用的最大磁盘空间(超出后将清理最旧的日志文件),单位支持B、KB、MB、GB、TB、PB,默认40GB
max-volume: {{ .Values.log.clearByVolumeUsage.maxVolume }}
Original file line number Diff line number Diff line change
Expand Up @@ -371,5 +371,13 @@ data:
root: {{ .Values.bkFeedBackUrl }}
deploy:
mode: lite
log:
# 服务后台日志保留的小时数,默认168小时(7天)
keep-hours: 168
# 根据磁盘占用量自动清理后台日志相关配置
clear-by-volume-usage:
# 是否开启自动清理任务,默认开启
enabled: true
# 服务后台日志可使用的最大磁盘空间(超出后将清理最旧的日志文件),单位支持B、KB、MB、GB、TB、PB,默认200GB
max-volume: 200GB
{{- end }}
11 changes: 11 additions & 0 deletions support-files/kubernetes/charts/bk-job/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,17 @@ persistence:
# 临时文件根路径(使用HostPath作为本地存储时同时也是宿主机根路径)
path: /data/job_temp_file

# 日志留存配置
log:
# 服务后台日志保留的小时数,默认48小时(2天)
keepHours: 48
# 根据磁盘占用量自动清理后台日志相关配置
clearByVolumeUsage:
# 是否开启自动清理任务,默认开启
enabled: true
# 服务后台日志可使用的最大磁盘空间(超出后将清理最旧的日志文件),单位支持B、KB、MB、GB、TB、PB,默认40GB
maxVolume: 40GB

## 蓝鲸日志采集配置
bkLogConfig:
# 是否开启蓝鲸日志采集
Expand Down
10 changes: 0 additions & 10 deletions support-files/templates/#etc#job#job-analysis#job-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,3 @@ feign:
default:
connectTimeout: 5000
readTimeout: 300000

log:
# 当前服务后台日志保留的小时数,默认168小时(7天)
keep-hours: 168
# 根据磁盘占用量自动清理后台日志相关配置
clear-by-volume-usage:
# 是否开启自动清理任务,默认开启
enabled: true
# 当前服务后台日志可使用的最大磁盘空间(超出后将清理最旧的日志文件),默认200GB
max-volume: 200GB
9 changes: 9 additions & 0 deletions support-files/templates/#etc#job#job-common#application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,12 @@ cmdb:
swagger:
url: swagger.job.com

log:
# 服务后台日志保留的小时数,默认168小时(7天)
keep-hours: 168
# 根据磁盘占用量自动清理后台日志相关配置
clear-by-volume-usage:
# 是否开启自动清理任务,默认开启
enabled: true
# 服务后台日志可使用的最大磁盘空间(超出后将清理最旧的日志文件),单位支持B、KB、MB、GB、TB、PB,默认200GB
max-volume: 200GB

0 comments on commit fb82373

Please sign in to comment.