Azure AKS审核日志视图

时间:2020-03-08 15:42:40

标签: audit azure-aks

我遵循此说明以获取AKS审核日志。

https://docs.microsoft.com/en-us/azure/aks/view-master-logs

我找不到一些基本字段,例如舞台,级别,用户名。

我如何查看带有完整日志的“ k8s审核”?

AKS audit logs

1 个答案:

答案 0 :(得分:0)

这是一个入门示例查询。它扩展了log_s字段并消除了一些噪音,试图在用户修改Kubernetes中的资源时仅给出日志。 requestURI和requestObject字段将为您提供有关用户正在执行的操作的最多信息。

AzureDiagnostics
| where Category == "kube-audit"
| extend log_j=parse_json(log_s) 
| extend requestURI=log_j.requestURI 
| extend verb=log_j.verb 
| extend username=log_j.user.username
| extend requestObject = parse_json(log_j.requestObject)
| where verb !in ("get", "list", "watch", "")
| where username !in ("aksService", "masterclient", "nodeclient")
| where username !startswith "system:serviceaccount:kube-system"
| where requestURI startswith "/api/"
| where requestURI !startswith "/api/v1/nodes/"
| where requestURI !startswith "/api/v1/namespaces/kube-system/"
| where requestURI !startswith "/api/v1/namespaces/ingress-basic/"