IntroductionRhit can read Nginx log files from standard folders (gzipped compressed files are also acceptable), analyze and count them, and display them in a visual table in the console without generating any unnecessary temporary files or data. You can filter and match by date, response value, request source, etc. and perform analysis. Rhit is very efficient and can process millions of lines of log data per second. The following are the results of searching for status codes 1xx and 2xx in the logs for January: The project address is: https://github.com/Canop/rhit InstallDownload and use the compiled binary file directly, but you need to make sure that the shell can find the rhit binary file. An easier way to deal with it is to put it in the /usr/local/bin directory and add executable permissions to it. chmod +x rhit // Download address: https://dystroy.org/rhit/download Install from crates.io, depending on the Rust environment, use the following command to install: cargo install rhit Source code installation depends on the Rust environment. After cloning the GitHub source code, enter the rhit folder and run the following command: cargo install --path . Display Fieldsrhit can automatically open the nginx log file in the default directory, or you can specify the log path in the command line parameters: rhit my/archived/logs Common nginx log lines are as follows:
It consists of several fields: date, remote IP address, path, bytes sent, etc. rhit can execute a list of fields to sort the table. If not specified, it will be displayed by date, status code, source and path by default. If you want to specify multiple fields, separate them with commas, such as -f date,status; to display all fields, use -f all. Date based. Use --field date, or -f date for short. By default, the length of the bar graph is based on the number of hits, but you can modify the sort key to be based on the number of bytes sent. IP-based. By default, the remote IP is not displayed. You can use rhit -f ip to display it. Based on the request method. The HTTP request method is not displayed by default. You can use rhit -f method to display it. Path based. The command is Based on Referer. The command is Based on status code. The command is filterRhit provides some filters to filter the result list and display some data you want to see or don't want to see. Filter by date. Accurate to the day, the date format is year/month/day, such as filtering data from 2021/2/15 to 2021/2/20, you can also filter data greater than a certain time, less than a certain time, or not containing a certain time (using '>', '<', '!' symbols): Filter by remote IP. The parameter is -i, which filters a specific IP, or excludes a specific IP (using the '!' symbol). Filter by request method. The parameter is -m, which filters specific methods or excludes specific methods. To filter by request path, use the -p parameter, which can be exact match or regular expression (for example, all paths start with "download" and end with "exe":, the parameter is -p 'download.*exe$'): Filter by Referer. The parameter is -r, which is consistent with the syntax for filtering by path: Filter by status code. The parameter is -s, which filters specific status codes or excludes specific status codes. Combined screening. The above methods can be combined in any way. Sort KeyBy default, all tables are sorted by hits, which is the sort key, and all values of the sort key are shown in pink, including the histogram. If you are more interested in the number of bytes sent, you can change the sort key to bytes using -kb: This is the end of this article about Rhit efficient visual Nginx log viewing tool. For more related Rhit Nginx log viewing tool content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Two special values in CSS are used to control the inherit and initial methods of the cascade
>>: How to add links to FLASH in HTML and make it compatible with all major browsers
Here is a single-line layout using ul>li for l...
This article hopes to gain some insights through a...
describe When calling this interface, you need to...
Questions about select elements in HTML have been...
1. Introduction table_cache is a very important M...
ARGB is a color mode, which is the RGB color mode...
Table of contents Layout part: <div id="a...
This article shares the specific code of JavaScri...
Problem 1: Baidu Map uses tiled images (the map i...
Preface The previous article introduced the insta...
Many organizations have the need to back up file ...
Scenario 1: Due to server restrictions, only one ...
my.cnf is the configuration file loaded when MySQ...
Table of contents 1. Original demand 2. Solution ...
Preface Only Innodb and MyISAM storage engines ca...