如何查看系统日志中的所有消息?我正在寻找我的程序生成的已标记的消息,[pistreaming]
以便我可以使用符号找到这些消息grep
sudo more /var/log/syslog | grep -i pistreaming
我得到这样的输出:
Feb 23 19:31:49 opcrd logger: Starting pistreaming service...
Feb 23 19:31:52 opcrd [pistreaming] Initializing websockets server on port 8084
Feb 23 19:31:52 opcrd [pistreaming] Initializing HTTP server on port 8082
Feb 23 19:43:21 opcrd logger: Starting pistreaming service...
Feb 23 19:43:24 opcrd [pistreaming] Initializing websockets server on port 8084
Feb 23 19:43:24 opcrd [pistreaming] Initializing HTTP server on port 8082
Feb 23 19:43:24 opcrd [pistreaming] Initializing broadcast thread
Feb 23 19:43:24 opcrd [pistreaming] Starting recording
Feb 23 19:43:24 opcrd [pistreaming] Starting websockets thread
Feb 23 19:43:24 opcrd [pistreaming] Starting HTTP server thread
Feb 23 19:43:24 opcrd [pistreaming] Stopping recording
Feb 23 19:43:25 opcrd [pistreaming] Waiting for broadcast thread to finish
但是,如果我不这样做grep
,这些消息似乎不会显示在日志中;我究竟做错了什么?
答案1
使用 sudo grep -i pistreaming /var/log/syslog。
这将显示文件的所有内容,管道将优化输出,并且仅显示包含 pistreaming 的行。
谢谢@panki