在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:goaccess开源软件地址:https://gitee.com/songboy/goaccess开源软件介绍:GoAccessWhat is it?GoAccess is an open source real-time web log analyzer and interactiveviewer that *runs in a terminal in nix systems or through your browser. Itprovides fast and valuable HTTP statistics for system administrators thatrequire a visual server report on the fly.More info at: http://goaccess.io. FeaturesGoAccess parses the specified web log file and outputs the data to the Xterminal. Features include:
Nearly all web log formats...GoAccess allows any custom log format string. Predefined options include, butnot limited to:
Why GoAccess?GoAccess was designed to be a fast, terminal-based log analyzer. Its core ideais to quickly analyze and view web server statistics in real time withoutneeding to use your browser (great if you want to do a quick analysis of youraccess log via SSH, or if you simply love working in the terminal). While the terminal output is the default output, it has the capability togenerate a complete real-time You can see it more of a monitor command tool than anything else. InstallationGoAccess can be compiled and used on *nix systems. Download, extract and compile GoAccess with: $ wget http://tar.goaccess.io/goaccess-1.0.2.tar.gz$ tar -xzvf goaccess-1.0.2.tar.gz$ cd goaccess-1.0.2/$ ./configure --enable-geoip --enable-utf8$ make# make install Build from GitHub (Development)$ git clone https://github.com/allinurl/goaccess.git$ cd goaccess$ autoreconf -fiv$ ./configure --enable-geoip --enable-utf8$ make# make install DistributionsIt is easiest to install GoAccess on Linux using the preferred package managerof your Linux distribution. Please note that not all distributions will have the lastest version ofGoAccess available Debian/Ubuntu# apt-get install goaccess NOTE: It is likely this will install an outdated version of GoAccess. Tomake sure that you're running the latest stable version of GoAccess seealternative option below. Official GoAccess Debian & Ubuntu repository$ echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list$ wget -O - http://deb.goaccess.io/gnugpg.key | sudo apt-key add -$ sudo apt-get update$ sudo apt-get install goaccess Note:
Fedora# yum install goaccess Arch Linux# pacman -S goaccess Gentoo# emerge net-analyzer/goaccess OS X / Homebrew# brew install goaccess FreeBSD# cd /usr/ports/sysutils/goaccess/ && make install clean# pkg install sysutils/goaccess OpenBSD# cd /usr/ports/www/goaccess && make install clean# pkg_add goaccess OpenIndiana# pkg install goaccess pkgsrc (NetBSD, Solaris, SmartOS, ...)# pkgin install goaccess WindowsGoAccess can be used in Windows through Cygwin. StorageThere are three storage options that can be used with GoAccess. Choosing onewill depend on your environment and needs. Default Hash TablesIn-memory storage provides better performance at the cost of limiting thedataset size to the amount of available physical memory. By default GoAccessuses in-memory hash tables. If your dataset can fit in memory, then this willperform fine. It has very good memory usage and pretty good performance. Tokyo Cabinet On-Disk B+ TreeUse this storage method for large datasets where it is not possible to fiteverything in memory. The B+ tree database is slower than any of the hashdatabases since data has to be committed to disk. However, using an SSD greatlyincreases the performance. You may also use this storage method if you needdata persistence to quickly load statistics at a later date. Tokyo Cabinet On-Memory Hash DatabaseAn alternative to the default hash tables. It uses generic typing and thus it'sperformance in terms of memory and speed is average. Command Line / Config OptionsThe following options can be supplied to the command or specified in theconfiguration file. If specified in the configuration file, long options needto be used without prepending
UsageDifferent OutputsTo output to a terminal and generate an interactive report: # goaccess -f access.log To generate an HTML report: # goaccess -f access.log -a > report.html To generate a JSON report: # goaccess -f access.log -a -d -o json > report.json To generate a CSV file: # goaccess -f access.log --no-csv-summary -o csv > report.csv The The The Multiple Log FilesFiltering can be done through the use of pipes. For instance, using grep tofilter specific data and then pipe the output into GoAccess. This adds a greatamount of flexibility to what GoAccess can display. For example: If we would like to process all # zcat -f access.log* | goaccess# zcat access.log.*.gz | goaccess Note: On Mac OS X, use Real Time HTML OutputGoAccess has the ability the output real-time data in the HTML report. You caneven email the HTML file since it is composed of a single file with no externalfile dependencies, how neat is that! To output an HTML report and set the WebSocket server to listen on port 7890and localhost. # goaccess -f access.log -o report.html --real-time-html If GoAccess is running and parsing logs on a specific host, you can specify theURL to which the client's browser will connect to. # goaccess -f access.log -o report.html --real-time-html --ws-url=goaccess.io To use a different port other than 7890, you can specify it as: # goaccess -f access.log -o report.html --real-time-html --ws-url=goaccess.io --port=9870 And to bind the WebSocket server to a different address other than 0.0.0.0, youcan specify it as: # goaccess -f access.log -o report.html --real-time-html --ws-url=goaccess.io --addr=127.0.0.1 Working with DatesAnother useful pipe would be filtering dates out of the web log The following will get all HTTP requests starting on # sed -n '/05\/Dec\/2010/,$ p' access.log | goaccess -a or using relative dates such as yesterdays or tomorrows day: # sed -n '/'$(date '+%d\/%b\/%Y' -d '1 week ago')'/,$ p' access.log | goaccess -a If we want to parse only a certain time-frame from DATE a to DATE b, we can do: # sed -n '/5\/Nov\/2010/,/5\/Dec\/2010/ p' access.log | goaccess -a Virtual HostsAssuming your log contains the virtual host field. For instance: vhost.io:80 8.8.4.4 - - [02/Mar/2016:08:14:04 -0600] "GET /shop HTTP/1.1" 200 615 "-" "Googlebot-Image/1.0" And you would like to append the virtual host to the request in order to seewhich virtual host the top urls belong to awk '$8=$1$8' access.log | goaccess -a To exclude a list of virtual hosts you can do the following: # grep -v "`cat exclude_vhost_list_file`" vhost_access.log | goaccess Files & Status CodesTo parse specific pages, e.g., page views, # awk '$7~/\.html|\.htm|\.php/' access.log | goaccess Note, # tail -10 access.log | awk '{print $8}' Or to parse a specific status code, e.g., 500 (Internal Server Error): # awk '$9~/500/' access.log | goaccess ServerAlso, it is worth pointing out that if we want to run GoAccess at lowerpriority, we can run it as: # nice -n 19 goaccess -f access.log -a and if you don't want to install it on your server, you can still run it fromyour local machine: # ssh root@server 'cat /var/log/apache2/access.log' | goaccess -a Incremental Log ProcessingGoAccess has the ability to process logs incrementally through the on-diskB+Tree database. It works in the following way:
Examples// last month access log# goaccess -f access.log.1 --keep-db-files then, load it with // append this month access log, and preserve new data# goaccess -f access.log --load-from-disk --keep-db-files To read persisted data only (without parsing new data) # goaccess --load-from-disk --keep-db-files ContributingAny help on GoAccess is welcome. The most helpful way is to try it out and givefeedback. Feel free to use the Github issue tracker and pull requests todiscuss and submit code changes. Enjoy! |
请发表评论