Simplify and streamline your Magento 2 log management with this powerful bash script. This project, created by a Magento developer for Magento developers, offers an easy-to-use interface for viewing, tailing, and searching errors in your log files from your Magento 2 project in real time. Enhance your debugging and monitoring capabilities with color-coded log entries for better readability and quick issue identification.
- Tail Logs in Real-Time: Effortlessly tail all or specific log files directly from your Docker container, with color-coded output for ERROR, WARNING, INFO, and DEBUG messages.
- View Log Files: Quickly view the content of specific log files without leaving the command line.
- Search for Errors: Automatically search for and highlight ERROR, FATAL, CRITICAL, WARNING, INFO, and DEBUG messages in your log files.
- Customizable Options: Easily configure the path to your log files and the Docker container name, tailored to fit your specific setup.
- Interactive Menu: A user-friendly interactive menu to choose from various log management operations.
Screencast.from.2024-06-08.10-24-18.mp4
Screencast.from.2024-06-08.10-28-22.mp4
Screencast_from_2024-06-09_20-44-58.mp4
Screencast_from_2024-06-08_10-37-37.mp4
Screencast.from.2024-06-08.10-43-25.mp4
5. Configure Options: Set custom log file paths and container names according to your environment setup:
Screencast.from.2024-06-08.10-45-55.mp4
This functionality will be useful for those with log files stored in a folder other than the default, so you can change it to suit your needs. Also, for your convenience, if you don't want to change the path or container name, press Enter
to keep the сurrent value.
For example, your log files are found in the /var/log/Amasty/
folder, you can easily view them using this option:
Screencast.from.2024-06-08.11-03-31.mp4
Also, if your log files are found in the /var/log/Amasty/
folder using bin/log -t Amasty/some.log Amasty/some2.log
OR bin/log --tail Amasty/some.log Amasty/some2.log
you can easily view them.
Using bin/log -h
or bin/log --help
script displays help information, including a script description, examples of its use, arguments, and options:
Using bin/log --tail cron.log system.log
OR bin/log -t system.log cron.log
to shorten, you can monitor logs in real-time for two or more log files:
Screencast_from_2024-06-08_10-48-59.mp4
curl -O https://raw.githubusercontent.com/YevhenZvieriev/magento-logs/main/bin/log
Now you can make the bash script executable:
chmod +x ./log
- Run the script:
./bin/log
- Follow the on-screen menu to select the desired action.
Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
Given the length of the script, I've provided comments to help people understand if they would like to contribute.
This project is licensed under the MIT License.
(c) Yevhen Zvieriev