Skip to main content

Python CEF Parsing for Lizard People

Project description

https://img.shields.io/badge/license-Apache%202.0-blue.svg https://img.shields.io/badge/python-2.7,%203.6-blue.svg https://img.shields.io/badge/pypi-v0.1--beta7-green.svg

Pourover is the only chemicaly-altered CEF Log Parsing library for Python, ideal for consumption by Lizard People.

the requests guy does it so maybe it'll work for me

Some stuff we can do:

from datetime import datetime
import pourover


# Create log objects from a file
log = pourover.parse_file('test.log')

# useful properties like linecount and start_time
if log.linecount > 10:
    if log.has_syslog_prefix and log.start_time > datetime(year=2018, month=4, day=20):
        # perform some operations
        pass
    else:
        # perform some operations on a logfile that doesn't have syslog prefixes
        pass
else:
    # perform some operations on a really small log
    pass

# Find messages with a certain value in the header
search_results = log.search_headers('Specific Vendor')

for message in log:
    # iterate through each message in the log like you'd expect to be able to
    pass

# Logs can be indexed/sliced in the way you'd expect
first_message = log[0]
last_message = log[-1]

# Create message objects from a string
message = pourover.parse_line('Apr 15 22:11:20 testhost CEF:0|Test Vendor|Test Product|Test Version|100|Test Name|100|src=1.1.1.1 dst=1.1.1.2')

if message.has_syslog_prefix:
    if message.timestamp > datetime(year=2018, month=4, day=20):
        # perform an operation on logs from later than April 20th, 2018
        pass

if 'src' in message.extensions:
    # do something if it's got an extension called 'src'
    pass

if message.device_vendor == 'Some Vendor':
    # do something if the vendor is Some Vendor
    pass

# stick this message right onto that log (it'll even order the messages by timestamp - wow!)
log.append(message)

Installing :computer:

To install Pourover, simply run

$ pip install pourover
✨🐊✨

Features :crocodile:

- :dragon_face: Create CEF-formatted log lines from parameters with support for extensions and a syslog prefix
- :dragon_face: Create useful line objects from a string, or an entire log object from a file
- :dragon_face: Iterable log objects to manipulate collections of logs at once
- :dragon_face: Parse lines with or without syslog prefixes or extensions with ease
- :dragon_face: Search logs for messages with specific headers or extensions
- :dragon_face: And more to come…

Contributing :dragon:

:bug: Bugs:
Please create any issues you think I should check out! If there’s a bug you spot or a function you think is acting up, please let me know. This project will have tests eventually, but until then I’m sure there will be issues sprouting up from time to time!
:sparkles: New Features/PRs:
The project is still in it’s infancy, so PRs might have a rough time getting merged in while the codebase is in a constant state of flux, but I’d me more than happy to have a discussion with you about a new feature you’d like to see!

Get in Touch :snake:

If you’ve found a Bug or would like to make a feature request, please see the Contributing section above, thanks!

If you’d like to reach out, shoot me an email at zach@csh.rit.edu.

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

pourover-0.1b7.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

pourover-0.1b7-py2.py3-none-any.whl (15.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pourover-0.1b7.tar.gz.

File metadata

  • Download URL: pourover-0.1b7.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for pourover-0.1b7.tar.gz
Algorithm Hash digest
SHA256 c5150bfeb55a87d9e133b33853bc424304e73eb67a2784aecf21d1d4e549b769
MD5 96336ebbfd37b8d8c0204e0da91bcaf2
BLAKE2b-256 3df42b9d86fff7ae5ba6aab26ec5fab4d347d72a1e1b526d0b84e6f57b3026e4

See more details on using hashes here.

File details

Details for the file pourover-0.1b7-py2.py3-none-any.whl.

File metadata

  • Download URL: pourover-0.1b7-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for pourover-0.1b7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fd5948be5849ba20e5fe4de83f19eca572b1c76dd9d6d50d9877f7a22df066e8
MD5 83fdd34e1140c5f2fb4ecc82f12277aa
BLAKE2b-256 c626c3e3cde2df93d2da76fdf54cbf16696fcac331164c81868f3f0c8692ea6c

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