Skip to main content

Parse raw logs to tabular format

This package helps to parse new line delimited logs to tabular formats. The user provides the regex, file path and column names, and a dataframe will be returned.
Depending on the supplied mode (local/spark), a pandas dataframe or a spark dataframe will be returned.

Features

Local mode

  1. Regex matching is done using multiprocessing.
  2. Glob searching for files.
  3. Lazy evaluation of files. This allows larger than memory datasets to be parsed, but note that upon parsing, the resultant pandas dataframe must be able to fit in memory.

Installation

Purely for local usage (No pyspark)

pip install data-parser

Both local and pyspark

pip install data-parser[pyspark]

Usage - Local (Pandas)

from data_parser import DataSource

# Bind 9: Feb  5 09:12:11 ns1 named[80090]: client 192.168.10.12#3261: query: www.server.example IN A
dns = DataSource(
    path='/path/to/dnsdir/*.txt',  # Glob patterns supported
    mode='local'
)

# Pandas dataframe is returned
dns_df = dns.parse(
    regex='^([A-Z][a-z]{2})\s+(\d+) (\d{2}\:\d{2}\:\d{2}) (\S+).+client ([^\s#]+)#(\d+)',
    col_names=['month', 'day', 'time', 'nameserver', 'query_ip', 'port'],
    on_error='raise'
)

Usage - Spark (Pyspark)

from data_parser import DataSource

# Bind 9: Feb  5 09:12:11 ns1 named[80090]: client 192.168.10.12#3261: query: www.server.example IN A
dns = DataSource(
    path='/path/to/dns/log',
    mode='spark'
)

# Spark dataframe is returned
dns_df = dns.parse(
    regex='^([A-Z][a-z]{2})\s+(\d+) (\d{2}\:\d{2}\:\d{2}) (\S+).+client ([^\s#]+)#(\d+)',
    col_names=['month', 'day', 'time', 'nameserver', 'query_ip', 'port'],
    on_error='raise'
)

Metadata

Release files for data-parser 0.0.3

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

Source distribution (sdist)

Source distribution for data-parser 0.0.3
File Size Uploaded Provenance Actions
data_parser-0.0.3.tar.gz 4.0 kB Without provenance Details for data_parser-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for data-parser 0.0.3
File Interpreter ABI Platform Actions
data_parser-0.0.3-py3-none-any.whl Python 3 none any Details for data_parser-0.0.3-py3-none-any.whl

Total release size: 8.9 kB

Release files / data_parser-0.0.3.tar.gz

Download URL data_parser-0.0.3.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
603e10d3545be6ebdf26f156c261d68fca83ba8181790b85a6708cc2028481d8
BLAKE2b-256 checksum
How to use checksums
121a8173c02602628e06bf7914d47cd7a6849a15f37ecf56abb3a4db625a904e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

Release files / data_parser-0.0.3-py3-none-any.whl

Download URL data_parser-0.0.3-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f4936221a50471869d802b6ae100bf2f0c1db957411ec9791d319f5bc12214b
BLAKE2b-256 checksum
How to use checksums
fd0ac6860778eb3de09a321dcee3180fb7c75d3349e90195b4c1e430c90b6e13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.5

Security for data-parser 0.0.3

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.

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