使用阿里云日志服务收集Kubernetes集群日志,现在需要单独收集某个命名空间下的日志。
修改logstore的配置如下:
{
"inputs": [
{
"detail": {
"Stderr": true,
"K8sNamespaceRegex": "^(dev)$",
"Stdout": true
},
"type": "service_docker_stdout"
}
],
"processors": [
{
"detail": {
"SourceKey": "content",
"KeepSource": false,
"NoKeyError": true
},
"type": "processor_json"
},
{
"detail": {
"SourceLocation": 8,
"SourceKey": "_@timestamp",
"DestLocation": 8,
"AlarmIfFail": true,
"DestKey": "time",
"SetTime": true,
"SourceFormat": "2006-01-02T15:04:05Z07:00",
"DestFormat": "2006/01/02 15:04:05",
"KeepSource": false,
"NoKeyError": true
},
"type": "processor_gotime"
}
]
}
如上,只收集了dev命名空间下的日志。
收集后的日志如下:


1194

被折叠的 条评论
为什么被折叠?



