我试图使用 promtail 屏蔽日志中的敏感数据,例如应用程序日志中的个人信息,但我无法屏蔽它。我使用 promtail loki grafana 作为我的监控堆栈。我的应用程序部署在 gke 中。我的配置图
apiVersion: v1
kind: ConfigMap
metadata:
name: promtail-config
namespace: default
labels:
app.kubernetes.io/name: promtail
data:
promtail.yaml: |
server:
http_listen_port: 9080
clients:
- url: http://grafana-loki.default.svc.cluster.local:3100/loki/api/v1/push
positions:
filename: /tmp/positions.yaml
scrape_configs:
- job_name: your_log_job
static_configs:
- targets:
- localhost
labels:
job: your_log_job_label`
pipeline_stages:
- regex:
expression: "Password: (.*)"
source: message
target: __password_masked__
- labels:
masked_log: true`
这是我的样本日志
[INFO] [User: John Doe] [Action: Record Addition] [IP: 123.456.789.123]
[INFO] [Details]
[INFO] [Name: John Doe]
[INFO] [Email: [email protected]]
[INFO] [Educational Institution: XYZ University]
[INFO] [Degree: Bachelor of Science]
[INFO] [Major: Computer Science]
[INFO] [Graduation Date: 2022-05-15]
[INFO] [Note: The user provided explicit consent for data collection during registration on [website/app name]. Data will be retained for a period of [X years] for record-keeping purposes.]
[INFO] [Password: Password]`
谁能帮我解决这个问题