Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Webalizer on Ubuntu system to analyze HTTP traffic

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to install Webalizer on the Ubuntu system to analyze HTTP traffic". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Webalizer is a free application that can be used to analyze web server logs. In this way, you can have a better understanding of the amount of traffic your site or server receives. It is a widely used open source tool that provides very detailed reports. This tool is easy to use and install, and many advanced managed dashboards such as cPanel use it to provide users with detailed information about traffic.

Functional characteristics

This tool is powerful enough to parse access logs in different formats. It can also get information from compressed files without first unzipping the files. You can use the tool from both the command line and the graphical user interface to view reports in a way that makes it convenient for you.

It supports multiple languages, and the development team is working to add features that support many other languages. It can parse log files of any size or complexity. It supports both IPV4 and IPV6, as well as native location services and DNS server software.

Install and configure Webalizer on Ubuntu

Webalizer requires the Apache website server software to be installed on the Linux system because it reads and parses the Apache error log to analyze traffic. If Apache is not previously installed on your system and you are trying to see how webalizer works, start the terminal and run the following command to install Apache on your Ubuntu:

The code is as follows:

Sudo apt-get install apache

Once Apache is installed, run the following command to start it.

The code is as follows:

Sudo / etc/init.d/apache2 start

Now launch your browser, load http://localhost, and verify that http is working properly, and it should display pages like this:

Apache default page

Note: by default, the document root of Apache is / var/www/html/, so you need to put the scripts in this location so that the Apache web server can provide them.

Now that Apache is installed and running on our Ubuntu system, run the following command to install webalizer.

The code is as follows:

Sudo apt-get install webalizer

Congratulations, webalizer has been installed. Now we need to configure it.

Configure webalizer

You may also notice that during installation, the webalizer directory has been created on the / var/www/ path, and we need to move it to / var/www/html so that Apache can smooth the directory. Run the following command on the terminal to accomplish this task.

The code is as follows:

Sudo mv / var/www/webalizer / var/www/html/

Now edit the Webalizer configuration file to correct the path for the Apache access log there. Run the following command to edit its configuration file using the Gedit editing tool.

The code is as follows:

Sudo gedit / etc/webalizer/webalizer.conf

It is important to make sure that the path to the Apache access log file is correct in the file (the highlighted part of the screenshot below). If there is an error in the path, correct the path and save the file.

Well, we are only one step away from success.

Test Webalizer configuration

Run the following command to verify that webalizer has been successfully installed and configured.

The code is as follows:

Sudo webalizer

A successful webalizer configuration should have the output shown in the following screenshot.

Test webalizer

Launch the browser and load http://localhost/webalizer/ URL. It should load the webalizer page with a report of the system's current HTTP activity.

You can execute webalizer-h to get all the command line arguments:

Usage: webalizer [options] [log file]

-h = print help information

-v-V = print version information

-d = print additional debugging information

-F type = log format type. Type= (clf | ftp | squid)

-I = ignore historical files

-p = reserved state (incremental mode)

-Q = ignore message information

-Q = ignore all information

-Y = ignore country graphics

-G = ignore hourly statistical graphs

-H = ignore hour statistics

-L = ignore color legend

-l num = use digital background lines in the drawing

-m num = access timeout (seconds)

-T = print time information

-c file = specify profile

-n name = hostname used

-o dir = result output directory

-t name = specify the hostname on the report title

-a name = hide the user agent name

-r name = hide access links

-s name = hide the customer

-u name = hide URL

-x name = use file extension

-P name = page type extension

-I name = index alias

-A num = shows the first few customer types

-C num = shows the top countries

-R num = show the first few links

-S num = shows the first few customers

-U num = shows the top URLs

-e num = shows the top several visited pages

-E num = display pages that do not exist in the first few names

-X = hide individual users

-D name = use dns cache file

-N num = number of DNS processes (0 = disable dns)

Assuming that the host name of the web server is www.test.com, the domain name of the statistics site is www.test.com, and the access log is / var/log/httpd/access_log, we output the results of webalizer analysis to / var/www/html/log. Then we can create the following script / etc/rc.d/webalizer:

The code is as follows:

#! / bin/sh

Run=/usr/sbin/webalizer

$run-F clf-p-n ""-t "www.test.com"

-o / var/www/html/log / var/log/httpd/access_log

Description:

-F clf indicates that our web log format is the standard general log file format (Common Logfile Format)

-p specifies to use the incremental mode, which means that after each analysis, webalizer produces a history file so that the next analysis does not analyze the parts that have already been processed. In this way, we can convert our log files in a short time without having to worry about the unlimited increase of log files when the traffic is too large.

-n "" specifies that the server hostname is empty, so the output will be more beautiful.

-o "www.test.com" specifies the title of the output result.

/ var/log/httpd/access_log: specify the log file

Then add in / etc/crontab:

01 1 * root / etc/rc.d/webalizer

That is, the script is executed at 1 a. M. every day.

Then run / etc/rc.d/init.d/crond reload to reload the crond service.

Concluding remarks

Webalizer is a tool widely used on Microsoft Windows, Linux and Mac OS, which can be used to analyze Web activities on the system. It is a fairly simple tool that parses the server log of a Web site, even if it is accessed millions of times. There is no doubt about the importance of this tool to system and webmasters.

The content of "how to install Webalizer on Ubuntu system to analyze HTTP traffic" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report