下載源碼
#下載
$ wget https://tar.goaccess.io/goaccess-1.5.1.tar.gz
$ tar -xzvf goaccess-1.5.1.tar.gz
$ cd goaccess-1.5.1/
編譯前校驗(yàn)
- 安裝中出現(xiàn)異常及解決
$ ./configure --enable-utf8 --enable-geoip=legacy
#安裝geoIp
configure: error:
*** Missing development files for the GeoIP library
[admin.hq@localhost goaccess-1.5.1]$ yum -y install geoip-devel
checking for mvaddwstr in -lncursesw... no
configure: error: *** Missing development libraries for ncursesw
[admin.hq@localhost goaccess-1.5.1]$ sudo yum -y install ncurses-devel
- 安裝成功
# 安裝成功
[admin.hq@localhost goaccess-1.5.1]$ ./configure --enable-utf8 --enable-geoip=legacy
Your build configuration:
Prefix : /usr/local
Package : goaccess
Version : 1.5.1
Compiler flags : -pthread
Linker flags : -lnsl -lncursesw -lGeoIP -lpthread
UTF-8 support : yes
Dynamic buffer : no
Geolocation : GeoIP Legacy
Storage method : In-Memory with On-Disk Persistent Storage
TLS/SSL : no
Bugs : hello@goaccess.io
$ make
$ make install
# make 部分關(guān)鍵日志
make[3]: 進(jìn)入目錄“/home/admin.hq/monitor/goaccess-1.5.1”
/usr/bin/mkdir -p '/usr/local/bin'
/usr/bin/install -c goaccess '/usr/local/bin'
/usr/bin/mkdir -p '/usr/local/etc/goaccess'
/usr/bin/install -c -m 644 config/goaccess.conf config/browsers.list config/podcast.list '/usr/local/etc/goaccess'
/usr/bin/mkdir -p '/usr/local/share/man/man1'
/usr/bin/install -c -m 644 goaccess.1 '/usr/local/share/man/man1'
設(shè)置環(huán)境變量
- 跟據(jù)make install 路徑視不同情況設(shè)置
[admin.hq@localhost ~]$ goaccess -V
GoAccess - 1.5.1.
For more details visit: https://goaccess.io/
Copyright (C) 2009-2020 by Gerardo Orellana
Build configure arguments:
--enable-utf8
--enable-geoip=legacy
通過(guò)nginx發(fā)布web界面
- 實(shí)時(shí)生成html文件
通過(guò)nginx暴露report.html實(shí)時(shí)文檔
# /usr/local/nginx/html替換成自己的nginx的html路徑
goaccess access.log -o /usr/local/nginx/html/report.html --log-format=COMBINED --real-time-html &
頁(yè)面
ui.png