Skip to main content

Utility for parsing and extracting data from ELB logs

Project description

ELBLOG2DICT

Description

This module converts Amazon ELB traffic logs into a python dictionary format.

Installation

pip install elblog2dict

Usage

from elblog2dict import parser
import gzip

file_path = 'log1.log.gz'
with gzip.open(file_path, 'rb') as f:
    data = f.read()

extracted_data = parser.parse(data)

for data in extracted_data:
    print(data)

Output

'type': 'http', 
'timestamp': '2023-06-19T01:24:36.560391Z', 
'elb': 'app/crawling-ALB/df7b42c830cab31c', 
'client_ip': '185.254.196.173', 
'clent_port': '55646', 
'target_ip': '172.31.1.83', 
'target_port': '80', 
'request_processing_time': '0.012', 
'target_processing_time': '0.001', 
'response_processing_time': '0.000', 
'elb_status_code': '404', 
'target_status_code': '404', 
'received_bytes': '231', 
'sent_bytes': '3828', 
'request_method': 'GET', 
'url': 'http://15.165.214.35:80/.env', 
'http_version': 'HTTP/1.1', 
'user_agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36', 
'ssl_cipher': '-', 
'ssl_protocol': '-', 
'target_group_arn': 'arn:aws:elasticloadbalancing:ap-northeast-2:375350317796:targetgroup/crawling-TG/02bacd9ef5e3c0ab', 
'trace_id': 'Root=1-648fae54-2521fdf43f8d31f87fc9061b', 
'domain_name': '-', 
'chosen_cert_arn': '-', 
'matched_rule_priority': '0', 
'request_creation_time': '2023-06-19T01:24:36.547000Z', 
'actions_executed': 'waf,forward', 
'redirect_url': '-', 
'error_reason': '-', 
'target_port_list': '172.31.1.83:80', 
'target_status_code_list': '404', 
'classification': '-', 
'classification_reason': '-'

License

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

elblog2dict-1.0.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

elblog2dict-1.0.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file elblog2dict-1.0.0.tar.gz.

File metadata

  • Download URL: elblog2dict-1.0.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for elblog2dict-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7d53f87907f2d71c86e91306769c57f9a414e1aecd85aac6e10ed0456b64764d
MD5 35613cb705c32752e750c6275b4a4340
BLAKE2b-256 17939be04a4add1fc375fc847da90a79c583c1efb0ac6240281e9bd3af664bdd

See more details on using hashes here.

File details

Details for the file elblog2dict-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: elblog2dict-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for elblog2dict-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bff7909959426f4a904369d734f7ac88771e2b90dba27a9e4f987a670856a7c4
MD5 395c9750b5e6cafa058bcda65b565e9e
BLAKE2b-256 2436abebf94e57d9ed555ced591a95b6496f6623bdc8a85592d9d0c5d064b379

See more details on using hashes here.

Supported by

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