EMQX trace 指定客户端日志报错
背景:
用命令 emqx_ctl 跟踪指定客户端的日志
看下emqx_ctl 说明
./emqx_ctl
--------------------------------------------------------------------------------
trace list # List all traces started
trace start client <ClientId> <File> [<Level>] # Traces for a client
trace stop client <ClientId> # Stop tracing for a client
trace start topic <Topic> <File> [<Level>] # Traces for a topic
trace stop topic <Topic> # Stop tracing for a topic
--------------------------------------------------------------------------------
执行命令
./bin/emqx_ctl trace start client id log/id.log
报错
trace client_id **: "Cannot
trace at a log level (debug) lower than the primary log level
原因:
trace 的日志级别超过默认最大级别
解决:
设置默认日志级别(根据需要提高到debug)
1、打开 emqx/etc/emqx.conf
2、找到 log.level,改成 debug
3、重启(注意:直接 restart 不生效)
./bin/emqx stop
./bin/emqx start
4、重新trace 就可以成功了
结果文件在 emqx/log 里面
emqx使用文档
https://docs.emqx.io/docs/broker/v3/cn/config.html