1

我的 linux VM 安装了 Linux Azure 诊断扩展并配置为将系统日志消息推送到事件中心。

我可以在事件中心进程数据刀片上查看我的系统日志消息。现在我正在尝试将这些日志发送到 Azure 数据资源管理器,为此我执行了以下步骤

  1. 在 ADX 中创建一个集群。
  2. 创建了用于存储系统日志消息的 Database( Syslog) 和 table( )。SyslogTable
  3. 为系统日志表创建 JSON 映射,映射事件中心数据所包含的字段。
  4. 创建了将事件中心连接到 ADX 表的数据摄取连接。

一切都很好,没有任何错误,因为.show ingestion failures没有显示任何错误,但我无法看到 ADX 表的任何数据。

以下是示例配置。

以 Json 格式从事件中心查看的示例数据

{
    "time": "2020-05-18T15:54:01.0000000Z",
    "resourceId": "/subscriptions/xxxxx/resourceGroups/xxxx/providers/Microsoft.Compute/virtualMachines/vmname",
    "properties": {
      "ident": "systemd",
      "Ignore": "syslog",
      "Facility": "daemon",
      "Severity": "info",
      "EventTime": "2020-05-18T15:54:01.0000000",
      "SendingHost": "localhost",
      "Msg": "Removed slice User Slice of root.",
      "hostname": "vmname",
      "FluentdIngestTimestamp": "2020-05-18T15:54:01.0000000Z"
    },
    "category": "daemon",
    "level": "info",
    "operationName": "LinuxSyslogEvent",
    "EventProcessedUtcTime": "2020-05-19T07:39:48.5220591Z",
    "PartitionId": 0,
    "EventEnqueuedUtcTime": "2020-05-18T15:54:05.4390000Z"
  }

ADX 表架构

.create table SyslogTable (
eventTime: datetime,
resourceId: string,
properties: dynamic ,
category: string,
level: string,
operationName: string,
EventProcessedUtcTime: string,
PartitionId: int,
EventEnqueuedUtcTime: datetime
)

ADX Syslog 表映射

.create table SyslogTable ingestion json mapping "SyslogMapping" 
'['
' {"column":"eventTime", "Properties": {"Path": "$.time"}},'
' {"column":"resourceId", "Properties": {"Path":"$.resourceId"}},'
' {"column":"properties", "Properties": {"Path":"$.properties"}},'
' {"column":"category", "Properties": {"Path":"$.category"}},'
' {"column":"level", "Properties": {"Path": "$.level"}},'
' {"column":"operationName", "Properties": {"Path": "$.operationName"}},'
' {"column":"EventProcessedUtcTime", "Properties": {"Path": "$.EventProcessedUtcTime"}},'
' {"column":"PartitionId", "Properties": {"Path": "$.PartitionId"}},'
' {"column":"EventEnqueuedUtcTime", "Properties": {"Path": "$.EventEnqueuedUtcTime"}}'
']'

数据连接设置

Table: SyslogTable
Column Mapping: SyslogMapping
Data Format: Multiline Json/Json # tried with both

那么我在这里缺少什么?

4

2 回答 2

1

数据没有被推送到 ADX 表的问题是因为我$Default在数据连接设置中定义了消费者组,并且我已经在使用$Default消费者组从其他地方的 EH 获取事件。

因此,解决方案很简单,即为事件中心创建一个新的消费者组并创建新的数据连接。

于 2020-05-20T10:56:42.190 回答
0

考虑到表架构和有效负载架构时,您的摄取映射似乎没有任何问题。

例如,如果你运行它——你会看到数据被成功摄取

.ingest inline into table SyslogTable with(format=multijson, ingestionMappingReference='SyslogMapping') <|
{
    "time": "2020-05-18T15:54:01.0000000Z",
    "resourceId": "/subscriptions/xxxxx/resourceGroups/xxxx/providers/Microsoft.Compute/virtualMachines/vmname",
    "properties": {
      "ident": "systemd",
      "Ignore": "syslog",
      "Facility": "daemon",
      "Severity": "info",
      "EventTime": "2020-05-18T15:54:01.0000000",
      "SendingHost": "localhost",
      "Msg": "Removed slice User Slice of root.",
      "hostname": "vmname",
      "FluentdIngestTimestamp": "2020-05-18T15:54:01.0000000Z"
    },
    "category": "daemon",
    "level": "info",
    "operationName": "LinuxSyslogEvent",
    "EventProcessedUtcTime": "2020-05-19T07:39:48.5220591Z",
    "PartitionId": 0,
    "EventEnqueuedUtcTime": "2020-05-18T15:54:05.4390000Z"
}

要解决您面临的问题,并假设您已经保证数据已成功推送到 EventHub,我建议您通过 azure 门户为您的资源打开支持票证。

于 2020-05-19T15:53:01.190 回答