Skip to main content

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 details)

Uploaded Source

Built Distribution

lightsaillogger-0.1.6-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file lightsaillogger-0.1.6.tar.gz.

File metadata

  • Download URL: lightsaillogger-0.1.6.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for lightsaillogger-0.1.6.tar.gz
Algorithm Hash digest
SHA256 fca2dee33a96e4613a3f70cb165d4768095f48aae2990c95732f91097ea1455b
MD5 11e2acede2b8ceff3c33c2ca9e2dc2d6
BLAKE2b-256 3d66cddee54698fe1ee7f5ce2364d55f9a80d134de3f0be1e602b4f954fe45de

See more details on using hashes here.

File details

Details for the file lightsaillogger-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for lightsaillogger-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6d1dec12e7be2fe1b378e373fdbf3f4065f3777f41be61dac80427cdc59827bc
MD5 37a5c2a16128c7d7645078e136167627
BLAKE2b-256 664b87d7b65f60825aed96eaa750c3fb3a72c7d20957ffeb3330a5f162d9e709

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page