ti fs-journal append-journal-entries
向日志(Journal)追加一个 JSON 事件或一个 JSON 数组。
语法
ti fs-journal append-journal-entries
--journal-id <string>
[--dry-run]
[--entry-json <string>]
[--entry-type <string>]
[--file-system-id <string>]
[--fs-token <string>]
[--help]
[--idempotency-key <string>]
[--json-array]
[--source <string>]
[--subject <string>]
[--version]
选项
--journal-id <string>:Journal ID。[required]--dry-run:验证请求但不应用更改。--entry-json <string>:单个 JSON 日志条目对象;可重复指定。支持的字段请参见条目 JSON 格式。--entry-type <string>:当输入对象省略type时使用的条目类型。如果输入对象中显式指定了type,则其优先级更高。--file-system-id <string>:选择文件系统。你也可以设置TI_FS_FILE_SYSTEM_ID。--fs-token <string>:设置 Filesystem 访问令牌。如果省略,该命令会使用TI_FS_TOKEN环境变量。如果两者都未提供,该命令会使用为所选 Filesystem 本地存储的令牌。--help:显示帮助信息。--idempotency-key <string>:用于对同一追加请求的重试进行去重的键。如果省略,每次调用都会获得一个新的键。--json-array:从 stdin 读取 JSON 数组,而不是 JSONL。--source <string>:条目来源。--subject <string>:条目主题;可重复指定。--version:显示版本信息。
有关所有命令共享的选项,请参见全局选项。
条目 JSON 格式
每个输入对象支持以下字段:
当前不支持 artifact 引用。请勿在条目中包含 artifacts 或 artifact_refs。
如果指定了 --source,它会替换每个输入对象中的 source 值。--entry-type 仅适用于省略了 type 的对象。
示例
追加一个 JSON 条目:
# Record an event object and let the CLI or service apply default metadata. ti fs-journal append-journal-entries --file-system-id <file-system-id> --journal-id jrn-demo --entry-json '{"type":"task.started"}'追加一个幂等的类型化条目:
# Prevent retries from recording the same completion event twice. ti fs-journal append-journal-entries --file-system-id <file-system-id> --journal-id jrn-demo --entry-type task.completed --subject issue:42 --idempotency-key issue-42-complete从标准输入追加一个 JSON 数组:
# Batch multiple ordered events in a single append operation. printf '[{"type":"step.started"},{"type":"step.completed"}]' | ti fs-journal append-journal-entries --file-system-id <file-system-id> --journal-id jrn-demo --json-array