数据模型附录

注意:本文档不是规范,而是为支持 Logs 数据模型规范而提供的。此处提供的示例纯粹用于演示目的,并非详尽或规范性;如果需要精确的详细信息,请参阅相应的导出器文档。

附录 A. 示例映射

本节包含将其他事件和日志格式映射到此数据模型的示例。

RFC5424 Syslog

属性类型描述映射到统一模型字段
TIMESTAMPTimestamp事件发生的时间,由源时钟测量。Timestamp
SEVERITYenum定义事件的重要性。示例:DebugSeverity
FACILITYenum描述事件的来源。预定义的 Unix 进程列表。是事件源标识的一部分。示例:mail systemAttributes["syslog.facility"]
VERSIONnumber元数据:协议版本,与事件正交。Attributes["syslog.version"]
HOSTNAME字符串描述事件发生的地点。可能的值包括 FQDN、IP 地址等。Resource["host.name"]
APP-NAME字符串用户定义的应用程序名称。是事件源标识的一部分。Resource["service.name"]
PROCID字符串未明确定义。可用作协议操作目的的元数据字段,或可能是事件源标识的一部分。Attributes["syslog.procid"]
MSGID字符串定义事件的类型。是事件源标识的一部分。示例:“TCPIN”Attributes["syslog.msgid"]
STRUCTURED-DATAmap 数组取决于 SDID 的各种用例
可以描述事件源标识。
可以包含描述事件特定发生的数据。
可以是元数据,例如时间戳值的质量。
SDID origin.swVersion 映射到 Resource["service.version"]。SDID origin.ip 映射到 Attributes["client.address"]。其余 SDID -> Attributes["syslog.*"]
MSG字符串关于事件的自由格式文本消息。通常是人类可读的。Body

Windows Event Log

属性类型描述映射到统一模型字段
TimeCreatedTimestamp记录事件的时间戳。Timestamp
Levelenum包含事件的严重级别。Severity
Computer字符串事件发生的计算机的名称。Resource["host.name"]
EventIDuint提供程序用于标识事件的标识符。Attributes["winlog.event_id"]
Message字符串消息字符串。Body
Rest of the fields.any事件中的所有其他字段。Attributes["winlog.*"]

SignalFx Events

字段类型描述映射到统一模型字段
TimestampTimestamp事件发生的时间,由源时钟测量。Timestamp
EventType字符串简短的机器可理解的字符串,描述事件类型。SignalFx 特有的概念。无命名空间。示例:k8s Event Reason 字段。Attributes["com.splunk.signalfx.event_type"]
Categoryenum描述事件的来源和原因。SignalFx 特有的概念。示例:AGENT。Attributes["com.splunk.signalfx.event_category"]
Dimensionsmap<string, string>有助于与 EventType 和 Category 一起定义事件源的标识。来自同一事件源的事件的多个发生可能随时间发生,它们都具有 Dimensions 的值。Resource
Propertiesmap<string, any>关于特定事件发生情况的附加信息。与 Dimensions(对于特定事件源固定)不同,Properties 可以拥有来自同一事件源的每个事件发生的具有不同值。Attributes

Splunk HEC

我们将 HEC 映射到统一模型

字段类型描述映射到统一模型字段
timenumeric, string事件时间,以 epoch 时间格式,单位为秒。Timestamp
host字符串要分配给事件数据的 host 值。这通常是您从中发送数据的客户端的 host 名称。Resource["host.name"]
源代码字符串要分配给事件数据的 source 值。例如,如果您从正在开发的应用程序发送数据,您可以将此键设置为应用程序的名称。Resource["com.splunk.source"]
sourcetype字符串要分配给事件数据的 sourcetype 值。Resource["com.splunk.sourcetype"]
eventany事件原始正文的 JSON 表示。它可以是字符串、数字、字符串数组、数字数组、JSON 对象或 JSON 数组。Body
fieldsmap<string, any>指定一个包含显式自定义字段的 JSON 对象。Attributes
index字符串事件数据要索引的索引名称。如果您使用的 token 设置了 indexes 参数,则在此处指定的索引必须在允许的索引列表中。Attributes["com.splunk.index"]

当从统一模型映射到 HEC 时,我们应用此附加映射

Unified model element类型描述映射到 HEC
SeverityText字符串事件的严重性,作为人类可读的字符串。fields['otel.log.severity.text']
SeverityNumber字符串事件的严重性,作为数字。fields['otel.log.severity.number']
名称字符串简短的事件标识符,不包含可变部分。fields['otel.log.name']
TraceId字符串请求的 trace id。fields['trace_id']
SpanId字符串请求的 span id。fields['span_id']
TraceFlags字符串W3C trace flags。fields['trace_flags']

Log4j

字段类型描述映射到统一模型字段
InstantTimestamp事件发生的时间,由源时钟测量。Timestamp
LevelenumLog level。Severity
Message字符串Human readable message。Body
All other fieldsanyStructured data。Attributes

Zap

字段类型描述映射到统一模型字段
tsTimestamp事件发生的时间,由源时钟测量。Timestamp
levelenumLogging level。Severity
caller字符串Calling function 的文件名和行号。Attributes, key=TBD
msg字符串Human readable message。Body
All other fieldsanyStructured data。Attributes

Apache HTTP Server access log

字段类型描述映射到统一模型字段
%tTimestamp事件发生的时间,由源时钟测量。Timestamp
%a字符串Client addressAttributes["network.peer.address"]
%A字符串Server addressAttributes["network.local.address"]
%h字符串Client hostname。Attributes["client.address"]
%m字符串The request method。Attributes["http.request.method"]
%v,%p,%U,%q字符串可以组合成 URL 的多个字段。Attributes["url.full"]
%>s字符串Response status。Attributes["http.response.status_code"]
All other fieldsanyStructured data。Attributes, key=TBD

CloudTrail Log Event

字段类型描述映射到统一模型字段
eventTime字符串请求的时间(协调世界时 UTC)。Timestamp
eventSource字符串发出请求的服务。此名称通常是服务名称的简短形式,无空格,后跟 .amazonaws.com。Resource["service.name"]?
awsRegion字符串请求的 AWS 区域,例如 us-east-2。Resource["cloud.region"]
sourceIPAddress字符串发出请求的 IP 地址。Attributes["client.address"]
errorCode字符串如果请求返回错误,则为 AWS 服务错误。Attributes["cloudtrail.error_code"]
errorMessage字符串如果请求返回错误,则为错误的描述。Body
All other fields*Attributes["cloudtrail.*"]

Google Cloud Logging

字段类型描述映射到统一模型字段
timestamp字符串日志条目所描述事件发生的时间。Timestamp
resourceMonitoredResource生成此日志条目的被监控资源。Resource
log_name字符串log_name 字段的 URL 编码的 LOG_ID 后缀标识了此条目属于哪个日志流。Attributes[“gcp.log_name”]
json_payloadgoogle.protobuf.Struct日志条目负载,表示为 JSON 对象表示的结构。Body
proto_payloadgoogle.protobuf.Any日志条目负载,表示为协议缓冲区。Body
text_payload字符串日志条目负载,表示为 Unicode 字符串(UTF-8)。Body
severityLogSeverity日志条目的严重性。Severity
trace字符串日志条目关联的 trace,如果有的话。TraceId
span_id字符串日志条目关联的 trace 中的 span ID。SpanId
labelsmap<string,string>一组用户定义的(键,值)数据,提供关于日志条目的附加信息。Attributes
http_requestHttpRequest日志条目关联的 HTTP 请求,如果有的话。Attributes[“gcp.http_request”]
trace_sampled布尔值日志条目关联的 trace 的采样决策。TraceFlags.SAMPLED
All other fieldsAttributes[“gcp.*”]

Elastic Common Schema

字段类型描述映射到统一模型字段
@timestampdatetime记录事件的时间Timestamp
message字符串Any type of messageBody
labelskey/valueArbitrary labels related to the eventAttributes[*]
tagsarray of stringList of values related to the event?
trace.id字符串Trace IDTraceId
span.id*字符串Span IDSpanId
agent.ephemeral_id字符串Ephemeral ID created by agent**Resource
agent.id字符串Unique identifier of this agent**Resource
agent.name字符串Name given to the agentResource["telemetry.sdk.name"]
agent.type字符串Type of agentResource["telemetry.sdk.language"]
agent.version字符串Version of agentResource["telemetry.sdk.version"]
source.ip, client.ip字符串发出请求的 IP 地址。Attributes["client.address"]
cloud.account.id字符串ID of the account in the given cloudResource["cloud.account.id"]
cloud.availability_zone字符串Availability zone in which this host is running.Resource["cloud.zone"]
cloud.instance.id字符串Instance ID of the host machine.**Resource
cloud.instance.name字符串Instance name of the host machine.**Resource
cloud.machine.type字符串Machine type of the host machine.**Resource
cloud.provider字符串Name of the cloud provider. Example values are aws, azure, gcp, or digitalocean.Resource["cloud.provider"]
cloud.region字符串Region in which this host is running.Resource["cloud.region"]
cloud.image.id*字符串Resource["host.image.name"]
container.id字符串Unique container idResource["container.id"]
container.image.name字符串Name of the image the container was built on.Resource["container.image.name"]
container.image.tagArray of stringContainer image tags。**Resource
container.labelskey/valueImage labels。Attributes[*]
container.name字符串Container name。Resource["container.name"]
container.runtime字符串Runtime managing this container. Example: "docker"**Resource
destination.address字符串Destination address for the eventAttributes["destination.address"]
error.code字符串Error code describing the error.Attributes["error.code"]
error.id字符串Unique identifier for the error.Attributes["error.id"]
error.message字符串Error message。Attributes["error.message"]
error.stack_trace字符串The stack trace of this error in plain text。Attributes["error.stack_trace]
host.architecture字符串Operating system architecture**Resource
host.domain字符串Name of the domain of which the host is a member。
For example, on Windows this could be the host’s Active Directory domain or NetBIOS domain name. For Linux this could be the domain of the host’s LDAP provider。
**Resource
host.name字符串Hostname of the host。
It normally contains what the hostname command returns on the host machine。
Resource["host.name"]
host.id字符串Unique host id。Resource["host.id"]
host.ipArray of stringHost IPResource["host.ip"]
host.macarray of stringMAC addresses of the hostResource["host.mac"]
host.name字符串Name of the host。
It may contain what hostname returns on Unix systems, the fully qualified, or a name specified by the user。
Resource["host.name"]
host.type字符串Type of host。Resource["host.type"]
host.uptime字符串Seconds the host has been up。?
service.ephemeral_id字符串Ephemeral identifier of this service**Resource
service.id字符串Unique identifier of the running service. If the service is comprised of many nodes, the service.id should be the same for all nodes。**Resource
service.name字符串Name of the service data is collected from。Resource["service.name"]
service.node.name字符串Specific node serving that serviceResource["service.instance.id"]
service.state字符串Current state of the service。Attributes["service.state"]
service.type字符串The type of the service data is collected from。**Resource
service.version字符串Version of the service the data was collected from。Resource["service.version"]

* Not yet formalized into ECS。

** A resource that doesn’t exist in the OpenTelemetry resource semantic convention

This is a selection of the most relevant fields. See for the full reference for an exhaustive list。

附录 B: SeverityNumber 示例映射

SyslogWinEvtLogLog4jZapjava.util.logging.NET (Microsoft.Extensions.Logging)SeverityNumber
TRACEFINESTLogLevel.TraceTRACE
DebugVerboseDEBUGDebugFINERLogLevel.DebugDEBUG
FINEDEBUG2
CONFIGDEBUG3
InformationalInformationINFOInfoINFOLogLevel.InformationINFO
NoticeINFO2
警告警告WARNWarnWARNINGLogLevel.WarningWARN
ErrorErrorERRORErrorSEVERELogLevel.ErrorERROR
严重严重DpanicERROR2
AlertPanicERROR3
EmergencyFATALFatalLogLevel.CriticalFATAL

参考