Skip to main content

AWS JSON Term Matcher

aws_json_term_matcher is a Python package designed to parse and evaluate filter expressions, such as those found in AWS CloudWatch log filters. This tool uses Lark for PEG parsing and supports logical operations like AND, OR, and parentheses for grouping.

Features

  • Parses logical expressions from JSON filters
  • Supports && (AND), || (OR), and parentheses for nested expressions
  • Extensible to include evaluation and tree reduction (future updates)

Installation

Clone the repository and install the requirements:

pip install aws-json-term-matcher

What does this tool do?

This tool provides enhanced JSON term matching for logs, giving you more flexibility and functionality when working with CloudWatch Logs. It allows you to use more sophisticated filters to search through JSON log events, making your log filtering more efficient.

The key improvement is the ability to filter logs with patterns similar to those used in AWS CloudWatch Logs but with more powerful Python-based features.

Example

from aws_json_term_matcher.matcher import match

# Example log
log = {
    "eventType": "UpdateTrail",
    "bandwidth": 80,
    "latency": 45,
    "number": [0.001, 1000],
    "sourceIPAddress": "123.123.1.1",
    "resources": [
        "arn:aws:states:us-east-1:111222333444:execution:OrderProcessorWorkflow:d57d4769-72fd",
        "arn:aws:states:us-east-1:111222333444:stateMachine:OrderProcessorWorkflow"
    ]
}

# Example filter
filter_str = '{ $.bandwidth > 75 }'


# Apply filter to log
if match(log, filter_str):
    print("Log matches the filter!")
else:
    print("Log does not match.")

In this example, the tool filters a log based on bandwidth and latency values, similar to how AWS CloudWatch Logs filters JSON log events.

Documentation

For more information about the original JSON term matching feature in AWS CloudWatch Logs, check out the official AWS documentation.

Metadata

Release files for aws-json-term-matcher 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-json-term-matcher 0.1.5
File Size Uploaded Provenance Actions
aws_json_term_matcher-0.1.5.tar.gz 6.2 kB Without provenance Details for aws_json_term_matcher-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aws-json-term-matcher 0.1.5
File Interpreter ABI Platform Actions
aws_json_term_matcher-0.1.5-py3-none-any.whl Python 3 none any Details for aws_json_term_matcher-0.1.5-py3-none-any.whl

Total release size: 12.4 kB

Release files / aws_json_term_matcher-0.1.5.tar.gz

Download URL aws_json_term_matcher-0.1.5.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6015d69ee13ec3f0bbbfda8319ccd292beff36a98e316fbfc41bd29ab2588419
BLAKE2b-256 checksum
How to use checksums
230ea8166337406259aa2f298869cd4b0ab2ad197d4833f016e4e1478a2c236a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / aws_json_term_matcher-0.1.5-py3-none-any.whl

Download URL aws_json_term_matcher-0.1.5-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a94b07abfee26f094227178501c1f6b0b69231d5277d678ff10bb5a077cd6ff
BLAKE2b-256 checksum
How to use checksums
2e31c4b2dc111739605d49fc57a18f9a6625caf5691a585d0a445324a2ed6f11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Security for aws-json-term-matcher 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page