==========
A generic library for gathering stats from log files by running regexes
on them. Things you can do: \* Create and run any number of regexes on
any number of files in parallel. \* Aggregate stats by creating named
regex groups in your regexes \* Grab archived logs (so long as you tell
it where your archives live) \* Grab files from remote boxes \* Print
stats to console \* Print regex matches to console \* Search on gzipped
files
Installation
------------
The easiest manner of installation is to grab the package from the PyPI
repository.
::
pip install log_scraper
Usage
-----
Base Usage
^^^^^^^^^^
For off the cuff usage, you can just create a LogScraper object and tell
it what regexes to run and where to look for files. Eg.
::
from log_scraper.base import LogScraper
import log_scraper.consts as LSC
filepath = '/path/to/file'
filename = 'filename.ext'
scraper = LogScraper(default_filepath={LSC.DEFAULT_PATH : filepath, LSC.DEFAULT_FILENAME : filename})
scraper.add_regex(name='regex1', pattern=r'your_regex_here')
# To get aggregated stats
data = scraper.get_log_data()
# To print all the stats
scraper.print_total_stats(data)
# To print each file's individual stats
scraper.print_stats_per_file(data)
# To view log lines matching the regex
scraper.view_regex_matches(scraper.get_regex_matches())
The real power, though, is in creating your own class deriving from
LogScraper that presets the paths and the regexes to run so that anyone
can then use that anywhere to mine data from a process' logs.
Development
-----------
Dependencies
~~~~~~~~~~~~
- Python 2.7
- `paramiko <http://paramiko-www.readthedocs.org/en/latest/index.html>`_
Testing
~~~~~~~
To test successfully, you must set up a virtual environment On Unix, in
the root folder for the package, do the following:
``python -m virtualenv . source ./bin/activate ./bin/python setup.py develop``
Now you can make any changes you want and then run the unit-tests by
doing:
::
./bin/python setup.py test
Metadata
Release files for log_scraper 0.9.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| log_scraper-0.9.9.tar.gz | 12.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| log_scraper-0.9.9-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 27.0 kB
Release files / log_scraper-0.9.9.tar.gz
| Download URL | log_scraper-0.9.9.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e50f5e7864ab2c56bd31644690446a429191f071f559fba954557d017c896b0
|
|
BLAKE2b-256 checksum How to use checksums |
981a0dbae964b86eafbff7e4c9d57e82010a84289002bbcfa2394b7edd63c998
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / log_scraper-0.9.9-py2-none-any.whl
| Download URL | log_scraper-0.9.9-py2-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
af857d6b1aa44d1670b3585c6e5f7d76382a1df9c5325e092cc171ee9bb48b49
|
|
BLAKE2b-256 checksum How to use checksums |
e0351f5dae4516e20db134a916bffd6270e391326b6a2f012edbdca91e2240e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for log_scraper 0.9.9
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.