Log all your lightsail containers in 1 log file
Project description
Lightsail Logger
Lightsail Logger is a simple Python application designed to aggregate and display logs from all containers within a Lightsail service in one unified view. This tool is ideal for developers and operators who need a straightforward way to monitor and analyze logs from various containers running under a single Lightsail service.
Features
- Aggregate Logs: Collect logs from multiple containers in one service.
- Unified View: Display logs from all containers in a single overview.
- Customizable: Adjust the logging window by specifying the time range.
Installation
You can install Lightsail Logger using pip. Open your terminal and run:
pip install lightsaillogger
Usage
simply import the class and call the logger method
from lightsaillogger.logger import LightsailLogger
# initiate a instance of lightsaillogger with the name of your service and the fetch interval
logger = LightsailLogger(service_name="name_of_your_container_service", fetch_interval_seconds=10)
logger.start_logging(minutes=10) # Looks back for logs in the last 10 minutes
Output:
Outputs the logs of your containers in order
2024-09-02T14:06 rq-worker 12:06:15 low: Job OK (91add817-598d-4916-bb72-1acac49871bb)
2024-09-02T14:06 rq-worker Ending mock task
2024-09-02T14:06 rq-worker 12:06:15 Result is kept for 900 seconds
2024-09-02T14:11 nginx 172.26.37.209 - - [02/Sep/2024:12:11:03 +0000] "GET /fastapistatus HTTP/1.1" 200 15 "-" "ELB-HealthChecker/2.0" "-"
2024-09-02T14:11 fastapi INFO: 172.26.37.209:0 - "GET /fastapistatus HTTP/1.0" 200 OK
2024-09-02T14:11 nginx 172.26.5.144 - - [02/Sep/2024:12:11:04 +0000] "GET /fastapistatus HTTP/1.1" 200 15 "-" "ELB-HealthChecker/2.0" "-"
2024-09-02T14:11 fastapi INFO: 172.26.28.92:0 - "GET /fastapistatus HTTP/1.0" 200 OK
2024-09-02T14:11 fastapi INFO: 172.26.5.144:0 - "GET /fastapistatus HTTP/1.0" 200 OK
2024-09-02T14:11 nginx 172.26.28.92 - - [02/Sep/2024:12:11:04 +0000] "GET /fastapistatus HTTP/1.1" 200 15 "-" "ELB-HealthChecker/2.0" "-"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lightsaillogger-0.1.6.tar.gz
(4.2 kB
view hashes)
Built Distribution
Close
Hashes for lightsaillogger-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d1dec12e7be2fe1b378e373fdbf3f4065f3777f41be61dac80427cdc59827bc |
|
MD5 | 37a5c2a16128c7d7645078e136167627 |
|
BLAKE2b-256 | 664b87d7b65f60825aed96eaa750c3fb3a72c7d20957ffeb3330a5f162d9e709 |