azure - 如何将自定义日志转发到 Azure Sentinel
问题描述
我们使用 Azure Sentinel 来监控 IaaS 事件日志和 Azure 资源。作为应用程序开发人员,我想使用相同的平台来监控我们的定制应用程序。我想将自定义事件从 Azure 函数或应用服务发送到(最好)一个 HTTP 端点。例如
{
"user":"John",
"resource":"recordabc",
"result":"approved",
"time":"1 Jan 2020"
}
这是可能的,还是 Azure Sentinel 不是正确的技术?
解决方案
由于 Sentinel 使用与 Azure Monitor(或 Application Insights)相同的 Log Analytics 基础结构,因此您可以完成所有这些操作。
做这件事有很多种方法:
- 创建将数据提交到 Azure Sentinel 的 Log Analytics 工作区的自定义 Azure 函数
- 从 Functions 和 App Services 直接调用 Log Analytics 工作区
Microsoft 提供的一些关于使用 Azure Functions 执行此操作的链接:
https://docs.microsoft.com/en-us/azure/sentinel/create-custom-connector#connect-with-azure-functions
使用代码:https ://github.com/Zimmergren/LogAnalytics.Client
它归结为以下步骤:
logger.SendLogEntry(new TestEntity
{
Category = GetCategory(),
TestString = $"String Test",
TestBoolean = true,
TestDateTime = DateTime.UtcNow,
TestDouble = 2.1,
TestGuid = Guid.NewGuid()
}, "demolog").Wait();
推荐阅读
- awk - awk:从段落中跳过一行
- visual-studio - 为什么 VS 2017 更改了我的解决方案文件的 ProjectConfigurationPlatforms 部分?
- javascript - 如何在 JavaScript 中引用或提取单个值参数?
- python - 将元素列表分配到具有不同排除项的 3 个列表中
- r - 如何检查数据框的字符串列是否与另一个数据框的字符串列匹配?
- javascript - 在Javascript中查找二维数组中所有连续1的矩形的坐标
- swift - 内省和迭代枚举中的静态/计算属性
- perl - 如果多段内的模式匹配,如何加入多行
- mysql - 如何基于三个字段创建唯一密钥?
- rabbitmq - 无法将 RabbitMQ 节点连接到集群