azure - 如何从 azure kubernetes 集群获取审核日志?稍后我想用它来定义使用audit2rbac工具

标签 azure kubernetes audit azure-aks

需要根据审计日志定义RBAC。这可以是加入团队并提供访问权限的常规流程。

我发现audit2rbac工具简单易用。

需要有关 azure 上的 kubernetes 服务的指导。

最佳答案

以下是从 Azure Log Analytics 获取审核日志的示例查询。

它消除了一些噪音,以便尝试仅在用户修改 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/"

关于azure - 如何从 azure kubernetes 集群获取审核日志?稍后我想用它来定义使用audit2rbac工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57070577/

相关文章:

mongodb - 从外部 Web 服务器使用 MongoHQ 时预计会有多长时间的延迟

yum - 我可以使用哪个用于Oracle Linux 7的yum存储库来安装Kubernetes?

kubernetes - Helm升级超时,无法获取配置映射

javascript - Chrome 审核 : 1 inline script block was found in the head between an external CSS file. .."

sql-server - SQL Server Change Data Capture - 捕获进行更改的用户

c# - 是否可以在 Dynamics CRM (2013/2016) 中以编程方式禁用审计?

azure - "Web"网站与Windows Azure中的其他网站有什么区别?

azure - 将文本写入 Azure 存储中的文件

azure - 在Appinsigts中,确定查询返回的时间戳是否>24小时前

amazon-ec2 - AWS 云提供商上的 Kubernetes