由于从多个websocket服务中加载了错误的数据,Goaccess在实时HTML报告中显示了错误的数据

时间:2018-11-01 02:10:03

标签: websocket goaccess

我需要使用--real-time-html选项运行多个goaccess进程来分析多个日志。 我的命令是:

/usr/bin/goaccess --real-time-html -o /data/html/log1/index.html -f log/log1.log --port=7890
/usr/bin/goaccess --real-time-html -o /data/html/log2/index.html -f log/log2.log --port=7891
...

只有1个进程在运行时,一切正常,我可以在Chrome上看到websocket的数据帧,每个数据帧的长度通常相同;

但是当两个或多个进程正在运行时,发生了两件事:

  1. 在正在运行goaccess进程的终端上,“ SIGPIPE被捕获!”不断出来;
  2. 在网页上,仪表板不连续地显示错误的数据,并且我注意到浏览器接收到的websocket数据帧的长度完全不同(这意味着该网页从其他goaccess进程接收到不同的websocket数据帧) ,当数据帧长度类似于仅运行1个goaccess进程时的数据长度时,网页上显示的数据是正确的,而当数据帧长度ars不同时,则数据是错误的。

似乎即使我使用“ --port”选项运行goaccess进程来为每个WebSocket进程指定不同的端口,多个websocket服务仍然混杂在一起。

1 个答案:

答案 0 :(得分:0)

要运行多个实例,您需要确保以下内容:

  1. 在不同的端口--port上运行每个实例。
  2. 不同的管道(FIFO)--fifo-in=/path/in.1 --fifo-out=/path/out.1
  3. (可选) IFF ,您正在使用磁盘存储,那么您将需要--db-path=/path/instance1/来存储数据库文件的其他路径。

示例

goaccess -f /prod/access.log -o /var/www/html/prod.html --real-time-html --ws-url=192.168.1.2 --port=7890 --fifo-in=/tmp/prod.in --fifo-out=/tmp/prod.out

AND

goaccess -f /dev/access.log -o /var/www/html/dev.html --real-time-html --ws-url=192.168.1.2 --port=7891 --fifo-in=/tmp/dev.in --fifo-out=/tmp/dev.out

Source