-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Omri Eival
committed
Apr 21, 2018
1 parent
d7c6036
commit ef000b8
Showing
5 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Logging S3 Handler | ||
|
||
A python logging handler that streams lines to Aws S3 objects | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
Asynchronous multipart uploading relies on gevent greenlets | ||
|
||
``` | ||
boto3 | ||
gevent >= 1.2.2 | ||
``` | ||
|
||
### Installing | ||
|
||
Installation using pip | ||
|
||
``` | ||
pip install logging_s3_handler | ||
``` | ||
|
||
## Running the tests | ||
|
||
``` | ||
To Do | ||
``` | ||
|
||
### Examples | ||
Stream log records to S3 | ||
``` | ||
from logging_s3_handler import S3Handler | ||
KEY_ID="your_aws_auth_key" | ||
SECRET="your_aws_auth_secret" | ||
bucket="test_bucket" # The bucket should already exist | ||
handler = S3Handler("test_log", bucket, KEY_ID, SECRET) | ||
formatter = logging.Formatter('[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s') | ||
handler.setFormatter(formatter) | ||
logger = logging.getLogger('root') | ||
logger.setLevel(logging.INFO) | ||
logger.addHandler(handler) | ||
for i in range(0, 100000): | ||
logger.info("test info message") | ||
logger.warning("test warning message") | ||
logger.error("test error message") | ||
``` | ||
|
||
## Contributing | ||
|
||
Feel free to contact me for feature requests, improvements, participation questions and what not | ||
[email protected] | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE) file for details | ||
|
||
## Acknowledgments | ||
|
||
* Some of the code seen here was inspired by the smart_open package, which I considered utilizing for my purposes but decided to code my own way to match my exact needs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
__author__ = 'Omri Eival' | ||
__version__ = '0.1.1' | ||
|
||
from S3StreamHandler import S3Handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[metadata] | ||
description-file = README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from distutils.core import setup | ||
|
||
setup( | ||
name='logging_s3_handler', | ||
packages=['logging_s3_handler'], | ||
version='0.1.1', | ||
description='A logging handler that streams log records to Aws S3 objects', | ||
author='Omri Eival', | ||
author_email='[email protected]', | ||
url='https://github.com/omrikiei/logging_s3_handler/', | ||
download_url='https://github.com/omrikiei/logging_s3_handler/archive/0.1.tar.gz', | ||
keywords=['logging', 's3', 'aws', 'handler'], | ||
classifiers=[], | ||
install_requires=[ | ||
'boto3', | ||
'gevent >= 1.2.2' | ||
], | ||
) |