Skip to main content

s3logparse

A simple tool for parsing AWS S3 access logs. Can either be used from Python or via a command line wrapper.

Installation

Use pip

pip install s3-log-parse

Command Line usage

The s3logparse command line script will reformat logs according to the following conventions

  • All fields are tab separated

  • No fields are quoted

  • Null text fields (represented by -) are empty

  • Timestamp is ISO8601 formatted

  • Null numeric fields are converted to 0

The script can accept a single argument, the name of a log file

s3logparse mys3logfile.txt

piping will also work

cat allmys3logs/* | s3logparse

Python API

The parse_log_lines function iterates over raw log lines and converts them to a namedtuple with the following attributes: bucket_owner, bucket, timestamp, remote_ip, requester, request_id, operation, s3_key, request_uri, status_code, error_code, bytes_sent, object_size, total_time, turn_around_time, referrer, user_agent, version_id

Here is a simple example which extracts IP addresses from logs

from s3logparse import s3logparse

with open('mys3logs.txt') as fh:
    for log_entry in parse_log_lines(fh.readlines()):
        print(log_entry.ip_address)

Metadata

Release files for s3-log-parse 0.1.1

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

Source distribution (sdist)

Source distribution for s3-log-parse 0.1.1
File Size Uploaded Provenance Actions
s3-log-parse-0.1.1.tar.gz 2.9 kB Without provenance Details for s3-log-parse-0.1.1.tar.gz

Release files / s3-log-parse-0.1.1.tar.gz

Download URL s3-log-parse-0.1.1.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2cef0a2f7638c566b7fd7e33e421d300c2ba25fb89bb8b0a353a30f5147453c3
BLAKE2b-256 checksum
How to use checksums
4a62e0e3c9320897aa33f81d84068d23f2c1929670eac3d8c8dde7621a3e50ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for s3-log-parse 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

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