Skip to content

Commit

Permalink
Merge pull request #2 from pinzon/fix-info
Browse files Browse the repository at this point in the history
update readme and project info
  • Loading branch information
pinzon authored Oct 16, 2024
2 parents 4d7ca35 + 07ebd78 commit 0045df2
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 5 deletions.
45 changes: 42 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,45 @@
Clone the repository and install the requirements:

```bash
git clone https://github.com/yourusername/aws_json_term_matcher.git
cd aws_json_term_matcher
pip install -r requirements.txt
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

```python
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](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html#matching-terms-json-log-events).
12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[project]
name = "aws-json-term-matcher"
version = "0.1.0"
version = "0.1.1"
authors = [
{ name = 'Cristopher Pinzon', email = '[email protected]' }
]
description = "The core library and runtime of LocalStack"
description = 'A Python library for advanced filtering and matching of AWS JSON logs, designed to simplify log parsing and enhance filtering capabilities.'

requires-python = ">=3.8"
dependencies=[
"lark"
Expand All @@ -20,3 +21,10 @@ dev = [
test = [
"pytest"
]


[project.urls]
Repository = "https://github.com/pinzon/aws-json-term-matcher.git"

[tool.setuptools.dynamic]
readme = { file = ["README.md"], content-type = "text/markdown"}

0 comments on commit 0045df2

Please sign in to comment.