/pylog_parse

Parses a specific type of server log

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

pylog_parse

Parses logs

Installation

  • Clone the github repository
  • Install by going into directory in terminal and executing:
$ pip install pandas
$ pip install sqlalchemy
$ python setup.py install

Example

  • To execute you may copy this script and input your own information
  • Eventually command line arguments will be put in the place of manually creating a script
  • After creating a script like the one below and saving as example.py:
$ python example.py
# filename: example.py

import sqlalchemy
from pylog_parse import LogFile

# Path to zip file, doesn't have to be zip file
log_zip = '/path/to/target/Logs.zip'

# Create LogFile object
log = LogFile(test)

# Save log dataframe as csv
output_csv = '/path/to/some/dest_folder/Logs.csv'
log.to_csv(output_csv)

# sqlalchemy connection
conn_url = 'postgresql://scott:tiger@localhost:5432/database'
engine = sqlalchemy.create_engine(conn_url)
log.upload(engine, table='target_table')