Meaning and logic of log_id

更新时间:
复制 MD 格式

Overview

log_id uniquely identifies each log entry in the log system, making it the primary key for locating and investigating issues during log tracing and debugging. It was introduced in product version V2.4.18, and in SDK versions Android 1.4.2.PX, iOS 1.4.1.PX, and the mini program and web SDK 2.0.

What log_id identifies

log_id uniquely identifies a single log entry. Use it to locate a specific event, trace the context and timing of log activity, and diagnose instrumentation issues.

The uuid field in the event payload

The mini program, web, iOS SDK, and Android SDK automatically generate a unique uuid when an event fires. The HTTP service API and Java SDK require developers to supply the uuid field.

The following fields are used in log_id generation:

Field

Location in payload

Description

uuid

Under ekv

A unique identifier generated per event. Equal to the client timestamp of the event.

ts

Under ekv

Client timestamp of the event.

appkey

Request parameter

Identifies the application.

device ID

Request parameter

Identifies the device. Null if not available (server-side tracking).

Example event payload:

ekv:
{
	id:"button_clk",
  ts:11634950,
  cusp:{
  	button_name:"sss"
  },
  uuid:"1234567890"
}

log_id generation logic

log_id is the MD5 hash of a fixed set of fields. The formula differs between client-side SDKs and server-side integrations:

  • Client-side tracking (mini program, web, iOS SDK, Android SDK): MD5(uuid + client timestamp + appkey + device ID)

  • Server-side tracking (Java SDK / server-side API): MD5(uuid + client timestamp + appkey + device ID), where device ID is null if not available

For server-side integrations, omit device ID when it is not available — the MD5 computation treats it as null. To verify that a log_id is correct, look up the event in the log system using the log_id value returned after the event is reported.