抢先体验仅限邀请,SDK 尚未发布。申请邀请
跳到正文
文档

事件

lyrelog events 用 Explorer 的筛选条件搜索事件,实时跟踪新事件,并完整显示单个事件。

lyrelog events 就是终端里的 Explorer。它按从新到旧列出项目的事件;如果不另行指定,范围是最近 24 小时。 它也可以写作 lyrelog logs 和 lyrelog log。

lyrelog events --level warning+ --since 7d
Tilefall · production · last 7 days

10:30:07 ▌error    cloud_save_failed    sync  reason=schema_mismatch record=progress status=422
10:27:43 ▌error    cloud_save_failed    sync  reason=schema_mismatch record=progress status=422
10:24:48 ▌error    cloud_save_failed    sync  reason=schema_mismatch record=progress status=422
10:22:05 ▌error    cloud_save_failed    sync  reason=schema_mismatch record=progress status=422
10:17:06 ▌error    chat_socket_gave_up  chat  attempts=4 match_id=0d9acb1f-503f-4818-a5a1-19336d1f0d8a

Showing 5 events. For more: --cursor MTc5NTE2NjIyNjExMTo3...

第一行显示项目、环境和时间窗口。每个事件占一行:时间、级别、名称(message)、分类(category)和属性。 其他日期的事件还会显示日期。

筛选

这些筛选条件就是 Explorer 的筛选条件,取值也和它的地址栏参数一样:"a|b" 表示多个值中的任意一个,"!a" 表示除它以外的任何值。 请给它们加上引号,因为 | 和 ! 在 shell 中有特殊含义。

参数筛选依据
--level级别:error、error,critical,或用 warning+ 表示 warning 及更严重的级别。级别有 trace、debug、info、notice、warning、error、critical。
--message事件名(message),精确匹配
-q、--query搜索 message、分类和属性
--category分类(category):checkout、"a|b" 或 "!a"
--attr一个属性,path:value,或用 path!:value 表示“不是”。需要多个时重复该参数。
--user单个用户的 id(应用发送的 user_id)
--session单个会话的 id
--install单个安装的 id
--version应用版本:2.4.0,或 "2.4.0|2.4.1"
--platform平台:ios、android、web、python……
--device设备型号
--os操作系统版本
--country国家代码:ES,或 "ES|PT"
--locale区域设置:es_ES
--verified发送方的验证方式:server、app_attest、key_attestation、none。"!none" 只保留已验证事件。
--env环境。默认是项目的默认环境,与控制台一致;all 搜索所有环境。
lyrelog events --attr board.size:9 --attr result!:win
lyrelog events --level error --version "2.4.0|2.4.1" --platform '!web'
lyrelog events --user pl-fe0958c6 --since 7d --limit 500
lyrelog events --verified '!none'
lyrelog events --env all -q "card declined"

默认环境是项目的默认环境,所以以 development 发送的事件不会出现,除非你传入 --env development 或 --env all (参见环境)。

时间

参数作用
--since截至当前的时间窗口:15m、1h、6h、24h、7d、30d,或任意数量的 s、m、h、d 或 w。默认 24h。
--from开始时间
--to结束时间。默认为当前时间。
--oldest-first从窗口开头起,按从旧到新排列

--from 和 --to 接受以下格式:

  • RFC 3339:2026-11-19T10:00:00Z
  • 你电脑所在时区的日期和时间:2026-11-19 10:00
  • 日期:2026-11-19,表示你所在时区当天的零点
  • Unix 毫秒时间戳(1763550000000)或秒
  • 多久以前:2h、3d

--since 不能与 --from 或 --to 同时使用。只指定 --from 时,窗口截至当前;只指定 --to 时,窗口从它之前 24 小时开始。

lyrelog events --from 3d --to 2d
lyrelog events --from 2026-11-15 --to 2026-11-16 --oldest-first
Tilefall · production · Nov 15 00:00 to Nov 16 00:00

Nov 15 00:00:00 ▌info     leaderboard_submit_confirmed  leaderboards  board=tilefall.daily.pure latency_ms=420
Nov 15 00:00:11 ▌info     game_started                  game          board.seed=4052403362615 board.size=7 m…
Nov 15 00:00:17 ▌info     match_round_won               multiplayer   match_id=b60cc0cc-b294-46a3-9186-35c71a…

数量与分页

参数作用
-n、--limit最多返回多少个事件。默认 100。按需分页获取,每页最多 1,000 个。
--cursor从上一次列表停下的地方继续

当事件数超过 --limit 时,最后一行会给出获取后续事件要传入的 --cursor。加上这个参数再次运行同一条命令,筛选条件保持不变。 在 JSON 模式下,cursor 以 {"more":true,"next":"--cursor ..."} 的形式输出到 stderr(参见 JSON 约定)。

实时跟踪新事件

-f(--follow)先输出最近一小时内的最新事件(最多 --limit 个,从旧到新),然后每到达一个新事件就输出一个,直到你按 Ctrl-C。 它和控制台的实时模式一样,每 4 秒询问一次 Lyrelog 自上次以来收到了什么。新事件按到达顺序输出,所以手机离线后迟迟才发送的批次, 会在到达时显示,并带有它自己(更早)的时间,只要这些时间在最近 2 天以内。

lyrelog events -f
Tilefall · production · following, Ctrl-C to stop

10:41:52 ▌info     app_launch  app  cold_start_ms=612 launch_reason=icon

lyrelog events -f --level error 只跟踪错误。

筛选条件照常有效。--since、--from 和 --to 则无效,因为它显示的是从现在起到达的事件。在 JSON 模式下,它每行输出一个 JSON 对象 (NDJSON);每个对象除了自己的 ts,还有 received_at,即 Lyrelog 收到它的时间(Unix 毫秒)。如果服务器一段时间内无法连接, 它会在 stderr 上提示,并继续重试。会话结束或项目不存在时,它会停止。

events get

完整显示单个事件:谁、在哪里、应用、设备、属性和 payload。

lyrelog events get adea33e4-26eb-422e-b904-96649c0e7830
▌ cloud_save_failed  error
  sync

  Time         2026-11-20 10:30:07.485 CET  8m ago
  Event        adea33e4-26eb-422e-b904-96649c0e7830
  Player       pl-fe0958c6
  Session      51e19a18-ca3e-4428-a10b-baeadc7eaaf8
  Install      76f5a7d0-81b0-4c36-8908-eefd6c936abf
  App          com.example.tilefall 1.6.3 (202609301304)
  Device       iPhone18,2 iOS 27.2.0
  Locale       fr_FR
  Country      FR
  Environment  production
  Platform     ios

Attributes
  {
    "reason": "schema_mismatch",
    "record": "progress",
    "status": 422
  }

Payload
  {
    "description": "The server refused the save",
    "detail": "field 'mode' is not allowed in format 3; expected format 4"
  }

工具会按 id 在项目保存的所有事件中(整个保留期限内)查找该事件。传入 --ts 并给出事件的 Unix 毫秒时间(JSON 中的 ts 字段), 可以跳过这次查找,直接定位到它。

参数作用
--ts事件的 Unix 毫秒时间(跳过查找)

events summary

总数(事件、用户、会话、错误)以及每个字段最常见的值,与 Explorer 侧边栏显示的内容相同。它接受与 events 相同的筛选和时间参数。

lyrelog events summary --since 7d
Tilefall · production · last 7 days

  52,886 events  300 players  3,202 sessions  1,127 errors

  category     game 11.6k  leaderboards 10k  app 7,110  daily 5,362  campaign 5,126  account 3,304
  level        info 36.7k  debug 13.7k  error 1,110  warning 1,074  notice 292  critical 17
  version      2.0 30.4k  1.6.3 22.5k
  ...

events values

在筛选范围内,某个字段或某个属性(attr.<path>)最常见的值,也就是 Explorer 筛选菜单中提供的选项。字段包括 level、category、 message、version、device、country、environment、platform 和 verified。

lyrelog events values message --level error --since 7d
Tilefall · production · last 7 days

Message                    Events  Players
cloud_save_failed             823      124
daily_upload_failed           178      124
match_update_denied            43       38
leaderboard_submit_failed      29       17
chat_socket_gave_up            28       28
purchase_failed                 9        8
lyrelog events values attr.board.size
参数作用
--search只显示包含该文本的值

它也接受 events 的筛选和时间参数。

events attributes

事件所带的属性路径,最常见的排在最前。也可以写作 lyrelog events attrs。

lyrelog events attributes --of game_won --numeric
Attribute   Events
hints_used     360
seconds        360
参数作用
--of只看这些事件(message)中的属性:"a|b"
--numeric只看数值属性,也就是 insights trend --metric value 可以绘图的那些

它也接受 events 的筛选和时间参数。