trace 命令
trace 命令用于追踪某个 Client 或 Topic,打印日志信息到文件,详情请查看 日志与追踪。
命令 | 描述 |
---|---|
trace list | 列出所有开启的追踪 |
trace start client <ClientId> <File> [<Level>] | 开启 Client 追踪,存储指定等级的日志到文件 |
trace stop client <ClientId> | 关闭 Client 追踪 |
trace start topic <Topic> <File> [<Level>] | 开启 Topic 追踪,存储指定等级的日志到文件 |
trace stop topic <Topic> | 关闭 Topic 追踪 |
trace start client[]
开启 Client 追踪:
$ ./bin/emqx_ctl log primary-level debug
debug
$ ./bin/emqx_ctl trace start client clientid log/clientid_trace.log
trace clientid clientid successfully
$ ./bin/emqx_ctl trace start client clientid2 log/clientid2_trace.log error
trace clientid clientid2 successfully
trace stop client
关闭 Client 追踪:
$ ./bin/emqx_ctl trace stop client clientid
stop tracing clientid clientid successfully
trace start topic[]
开启 Topic 追踪:
$ ./bin/emqx_ctl log primary-level debug
debug
$ ./bin/emqx_ctl trace start topic topic log/topic_trace.log
trace topic topic successfully
$ ./bin/emqx_ctl trace start topic topic2 log/topic2_trace.log error
trace topic topic2 successfully
trace stop topic
关闭 Topic 追踪:
$ ./bin/emqx_ctl trace topic topic off
stop tracing topic topic successfully
trace list
列出所有开启的追踪:
$ ./bin/emqx_ctl trace list
Trace (clientid=clientid2, level=error, destination="log/clientid2_trace.log")
Trace (topic=topic2, level=error, destination="log/topic2_trace.log")