Certainly! Here's a refined version of the description:
X-UI Log Analyzer for Traffic Monitoring
X-UI Log Analyzer is a powerful tool designed for real-time monitoring of user traffic on the X-UI server. This script aims to provide timely insights into IP addresses, domains, and other relevant information, allowing administrators to monitor and analyze incoming and outgoing traffic with a suitable delay.
Key Features:
- Real-time Analysis: The script continuously monitors the server's access log, processing the latest entries to detect incoming and outgoing traffic in real-time.
- IP Address Insights: Gain valuable insights into the IP addresses accessing the server, allowing for effective traffic monitoring.
- Domain Recognition: Identify and analyze the domains associated with incoming and outgoing traffic, providing a comprehensive view of server interactions.
- Color-Coded Output: The script utilizes color codes for enhanced readability, highlighting Gmail domains in green, IP addresses in blue, and other domains in yellow.
- Automatic Log Cleanup: To maintain efficiency, the script automatically cleans up the access.log file at regular intervals.
Ethical Usage Disclaimer: This script is intended for ethical and responsible use in monitoring server traffic for analysis and troubleshooting purposes. It is essential to use this tool in compliance with ethical standards and legal regulations. The script's author disclaims any responsibility for misuse or unethical practices. Users are encouraged to adhere to ethical guidelines and legal frameworks when deploying this script.
Note: Administrators should exercise caution and responsibility, ensuring that the script is used for legitimate and ethical monitoring purposes. Any misuse or unethical actions using this script are the sole responsibility of the user.
Feel free to adjust the wording as needed!
-
Access the xray panel and navigate to the xray template section.
-
Locate the
log
section in the template, which looks like the following:
2-1.Remove the parameter:
{
"log": {
"loglevel": "warning",
"error": "./error.log"
2-2.Replace the parameter:
{
"log": {
"loglevel": "warning",
"access": "/usr/local/x-ui/access.log",
"error": "/usr/local/x-ui/error.log"
-
Ensure the path specified for
access.log
is correct and that the file is being created at that location. -
To retain logs and prevent access.log from being deleted, consider changing the
loglevel
fromwarning
to a higher level such asinfo
ordebug
. -
If the issue persists, check the system for the relevant log files and confirm that xray has the necessary permissions to write log files.
If you encounter any further issues or need more details, please provide additional information. Now, the error section has been removed from the template. In the specified directory (/usr/local/x-ui/), a file named access.log will be created to store the data. "Alright, now let's move on to step two, which is live monitoring of traffic logs for each user.
-
Bash Shell: Ensure that your system has Bash installed. You can check this by running the command
bash --version
in your terminal. If Bash is not installed, you can install it using your system's package manager. -
Tail Command: The script uses the
tail
command to read the last lines of the access.log file. Ensure that thetail
command is available in your system. You can install it using your system's package manager if it's not already installed. -
Host Command: The script utilizes the
host
command to resolve IP addresses to domain names. Make sure that thehost
command is installed on your system. You can install it using your system's package manager if it's not already installed. -
Whois Command: The script uses the
whois
command to retrieve domain information. Verify that thewhois
command is installed on your system. If it's not installed, you can install it using your system's package manager.
-
Download the Script: Download the script file to your local system.
-
Set Execution Permissions: Make the script executable by running the command
chmod +x script_name.sh
in the terminal, replacingscript_name.sh
with the actual name of your script file. -
Execute the Script: Run the script by executing
./script_name.sh
in the terminal, replacingscript_name.sh
with the actual name of your script file.
-
This script continuously monitors the access.log file and processes the last 3 lines to extract IP addresses and retrieve domain information.
-
It utilizes color codes to highlight different types of output: green for Gmail domains, blue for IP addresses, and yellow for other domains.
-
The script automatically cleans up the access.log file every 3 seconds
-
Bash Shell: Make sure that your system has Bash installed. You can verify this by running the command
bash --version
in your terminal. If Bash is not installed, you can install it using your system's package manager:sudo apt-get update sudo apt-get install bash
-
Tail Command: The script uses the
tail
command to read the last lines of the access.log file. Ensure that thetail
command is available on your system. If it's not installed, you can install it using:sudo apt-get install coreutils
-
Host Command: The script utilizes the
host
command to resolve IP addresses to domain names. Confirm that thehost
command is installed on your system:sudo apt-get install dnsutils
-
Whois Command: The script uses the
whois
command to retrieve domain information. Verify the presence of thewhois
command on your system:sudo apt-get install whois
-
Download the Script: Download the script file to your local system.
-
Set Execution Permissions: Make the script executable by running the command
chmod +x script_name.sh
in the terminal, replacingscript_name.sh
with the actual name of your script file. -
Execute the Script: Run the script by executing
./script_name.sh
in the terminal, replacingscript_name.sh
with the actual name of your script file. Certainly! Here are the instructions in English:
Download the script from your GitHub repository. You can use either wget
or curl
:
cd /usr/local/x-ui/
sudo wget https://raw.githubusercontent.com/leon1067/X-UI-Log-Analyzer/main/log.sh -P /usr/local/x-ui/
Ensure that the script is located in /usr/local/x-ui/
using the following command:
Make the script executable by running the following command:
sudo chmod +x /usr/local/x-ui/log.sh
Now you can execute the script:
sudo /usr/local/x-ui/log.sh
If you want the script to run automatically on system startup, you need to add it to system settings. Depending on your system, this can be done by adding the command to the .bashrc
or rc.local
file. The steps may vary based on your distribution.
With these steps, your script is installed next to access.log
in /usr/local/x-ui/
and can be executed using the provided commands.
-
This script continuously monitors the access.log file and processes the last 3 lines to extract IP addresses and retrieve domain information.
-
It utilizes color codes to highlight different types of output: green for Gmail domains, blue for IP addresses, and yellow for other domains.
-
The script automatically cleans up the access.log file every 3 seconds.