Skip to main content

Search AWS CloudWatch Logs with Insights queries and flexible time ranges from your command line.

Project description

saws

Searches AWS CloudWatch Logs with Insights queries and flexible time ranges from your command line.

NAME
    qaws.py -- Search AWS CloudWatch logs
SYNOPSIS
    qaws.py [-g groups...] \
            [-t starttime | starttime endtime] \
            [-q query]
DESCRIPTION
    -g --groups groups ...
        Specify 1 to N logging groups like "/ecs/someservice1"
    -t --time starttime | starttime endtime
        Specify starttime in history to more recent endtime in present.
        Possible formats for time specification is:
            ISO time:           "2000-01-01T00:00:00"
            Epoch in seconds:   "1590314700"
            Time relative to Now:      
                "1h"                    1 hour ago
                "1h 60m"                2 hours ago
                "1h 60m 3600s"          3 hours ago
                "3600s 60m 1h"          3 hours ago as well (order doesn't matter)
                "3600s 3600s 3600s"     3 hours ago as well (items are repeatable)
                "1y 1mo 1w 1d 1h 1m 1s" is possible as well
    -g --query query
        Query exactly as it is usually written in AWS CloudWatch Insights in Web Console:
            fields @timestamp, @message 
            | filter @message like 'event' 
            | limit 10"
    - It can take few minutes (~2 minutes) until logs appears in CloudWatch and therefore fetching logs 
        with '-t "1m"' may not return any results
    - Even if you set '|limit 1' in --query then CloudWatch will anyway search over entire specified '-t "10d"' 
        history which can take lot of time
EXAMPLES
    qaws.py \
        --groups      "/ecs/myservice0" \
        --time        "1h" \
        --query       "fields @message"
    qaws.py \
        --groups      "/ecs/myservice0" "/ecs/myservice1" "/ecs/myservice2" \
        --time        "1h 30m" \
        --query       "fields @message"
    qaws.py \
        --groups      "/ecs/myservice0" \
        --time        "1h" "30m" \
        --query       "fields @timestamp @message | filter @message like 'event' | limit 15"
    qaws.py \
        --groups      "/ecs/myservice0" \
        --time        "2020-05-24T00:00:00" "2020-05-24T12:00:00" \
        --query       "fields @message | filter @message like 'event'"
    qaws.py \
        --groups      "/ecs/myservice0" \
        --time        "1y" "2020-05-24T00:00:00" \
        --query       "fields @message | filter @message like 'event'"
    qaws.py \
        --groups      "/ecs/myservice0" \
        --time        "2020-05-24T00:00:00" "5h" \
        --query       "fields @message | filter @message like 'event' | limit 15"

AUTHORS
    Jiri Kacirek (kacirek.j@gmail.com) 2020
IMPLEMENTATION
    Python 3.8

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

qaws-0.0.6.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qaws-0.0.6-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file qaws-0.0.6.tar.gz.

File metadata

  • Download URL: qaws-0.0.6.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for qaws-0.0.6.tar.gz
Algorithm Hash digest
SHA256 f039fcd6917d2d6fa8999a2a10c640fe19164dcccccab4b0c887c282398b97c0
MD5 992755887600ae48d6f027a703dded8d
BLAKE2b-256 91c0b39f2e79635e733700047dcdb21c0253deb397b3c9496edd7398b6ec3c62

See more details on using hashes here.

File details

Details for the file qaws-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: qaws-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for qaws-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 85b90e807b9a4609d8a08601969557e216a3fcd1862da18123cb8bf2bd19ee0d
MD5 dc3b39e3fa7d9e04971a2b6012e33903
BLAKE2b-256 c0abeab2d061d5fac280a2c073dd26685b41523b24e2458794f59a1d9255cc3c

See more details on using hashes here.

Supported by

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