我使用helm安装loki和prometheus。但是,我想在一个地方替换原木。我用过:helm show values grafana/loki-stack>loki-stack-values。Yml输出值,得到以下结果:
loki:
enabled: true
isDefault: true
promtail:
enabled: true
config:
lokiAddress: http://{{ .Release.Name }}:3100/loki/api/v1/push
prometheusSpec:
additionalScrapeConfigs:
- match:
selector: '{name="promtail"}'
stages:
# The regex stage parses out a level, timestamp, and component. At the end
# of the stage, the values for level, timestamp, and component are only
# set internally for the pipeline. Future stages can use these values and
# decide what to do with them.
- regex:
expression: '.*level=(?P<level>[a-zA-Z]+).*ts=(?P<timestamp>[Td-:.Z]*).*component=(?P<component>[a-zA-Z]+)'
事实上,一切都会很好。但是我的输出很奇怪所以我试着添加additionalScapeConfig
2022-05-06 18:31:55
{"log":"2022-05-06T18:31:55,003 u001b[36mDEBUGu001b[m
对于这个问题:
如何使用helm install dlp-dev-loki grafana/loki-stack——values loki-stack-valuesYml -n dev. and additional scape configuration for promtail.
根据文档,promtail管道,时间戳阶段从regex阶段提取时间戳,并将其提升为日志条目的新时间戳,时间戳应该将其解析为rfc3339nano格式的值。将以下内容添加到regex下面的配置文件中:
- timestamp:
format: RFC3339Nano
source: timestamp