Library to query CloudWatch Logs and create Pandas DataFrame from the results
Project description
CloudWatchLogs2Pandas
This file will become your README and also the index of your documentation.
Install
pip install CloudWatchLogs2Pandas
How to use
You need to build your query based on the documentations here:
query = 'fields @timestamp, @message | sort @timestamp desc | limit 5'
log_group = '/aws/apigateway/welcome'
cwq = CloudWatchQuery(query, log_group)
When executing the query against the log group, the default time range of of 14 days.
cwq.get_df()
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
In case you have no results, you can modify the time range. For example
for Last Year you can use:
cwq.get_df(days_start=365)
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
| timestamp | message | ptr | |
|---|---|---|---|
| 0 | 2021-12-20 11:03:13.568 | Cloudwatch logs enabled for API Gateway | CmAKKAokMzI3MTYzODM3MDU1Oi9hd3MvYXBpZ2F0ZXdheS... |
| 1 | 2021-11-24 15:10:19.572 | Cloudwatch logs enabled for API Gateway | CmAKKAokMzI3MTYzODM3MDU1Oi9hd3MvYXBpZ2F0ZXdheS... |
| 2 | 2021-11-01 15:57:57.790 | Cloudwatch logs enabled for API Gateway | CmAKKAokMzI3MTYzODM3MDU1Oi9hd3MvYXBpZ2F0ZXdheS... |
| 3 | 2021-11-01 15:37:36.574 | Cloudwatch logs enabled for API Gateway | CmAKKAokMzI3MTYzODM3MDU1Oi9hd3MvYXBpZ2F0ZXdheS... |
| 4 | 2021-10-30 23:10:28.807 | Cloudwatch logs enabled for API Gateway | CmAKKAokMzI3MTYzODM3MDU1Oi9hd3MvYXBpZ2F0ZXdheS... |
Additional configurations
You can set the AWS region with:
cwq.set_region("us-west-2")
More complicated time range:
cwq.get_df(days_start=2, hours_start=4, hours_end=4)
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file CloudWatchLogs2Pandas-0.0.2.tar.gz.
File metadata
- Download URL: CloudWatchLogs2Pandas-0.0.2.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5ebf359a8ab7794d45b626c0f2b3c7cb929105f88ac7ac1480c3501f504c911
|
|
| MD5 |
4be994db73940c0a91b62e63abf31821
|
|
| BLAKE2b-256 |
1a9d51dcd3196dee8b790b19583cf78964ebd103ae7c1128dab54e09b3e50b23
|
File details
Details for the file CloudWatchLogs2Pandas-0.0.2-py3-none-any.whl.
File metadata
- Download URL: CloudWatchLogs2Pandas-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e201b66ddb4f5d0d55cff9728059b91427ca087f712374b28bd7cde3011e04b
|
|
| MD5 |
d4bd651961165f50b3fbef546cea676d
|
|
| BLAKE2b-256 |
160996e01e97ceb3c2f9cbaa2e7929d7fc3490a17d065d88ca9c663d41144e14
|