Skip to main content

findlog

Command-line tool that finds a failure in a log file and prints the lines around it.

pip install findlog
findlog server.log --around "Connection refused"

Install from source

git clone https://github.com/shauryaR790/findlog-py.git
cd findlog-py
pip install -e ".[dev]"

Commands

findlog server.log --around "Connection refused"
findlog server.log --line 8421
findlog server.log --around "Connection refused" --save
findlog server.log --around "Connection refused" --json

What it reports

For a matching line, findlog prints:

  • first match line number
  • occurrence count
  • lines before and after
  • other errors and warnings in the same window
  • file and line from a stack trace when the log includes one

It groups repeated matches that happen close together into one incident.

It does not guess root cause. It shows what the log contains near the failure.

Options

Option Description
--around TEXT Text or phrase to search for
--line N Line number to inspect
--context N Lines of context (default: 10)
--all Show every grouped incident
--regex Treat --around as a regex
--save Write incident lines to a file
--output PATH Path for saved slice
--json JSON output
--quiet Minimal output

Exit codes: 0 ok, 1 no match, 2 bad input, 3 file error.

Example

findlog server.log --around "Connection refused"
FINDLOG
------------------------------------

MATCH
  Connection refused

FIRST FAILURE
  line 5

OCCURRENCES
  3

RELATED
  Database connection failed
  Database unavailable

FOLLOWED BY
  line 12  Shutdown

Python API

from findlog import analyze_log

result = analyze_log("server.log", query="Connection refused")
print(result.primary_incident.first_match_line)

Notes

  • Reads files line by line. Does not load the whole file into memory.
  • Runs offline. Does not upload logs.
  • Does not modify the source log.

License

MIT License. See LICENSE.

Metadata

Release files for findlog 1.0.0

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

Source distribution (sdist)

Source distribution for findlog 1.0.0
File Size Uploaded Provenance Actions
findlog-1.0.0.tar.gz 15.5 kB With provenance Details for findlog-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for findlog 1.0.0
File Interpreter ABI Platform Actions
findlog-1.0.0-py3-none-any.whl Python 3 none any Details for findlog-1.0.0-py3-none-any.whl

Total release size: 31.8 kB

Release files / findlog-1.0.0.tar.gz

Download URL findlog-1.0.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5c5ed3caf8dd9160492d441855911dc4c7fa35eb6dc973151ebfc3f5ef4e3494
BLAKE2b-256 checksum
How to use checksums
84d37a3df52a624c6539a79f40c9e7585d9bfdb784feb4ca5c52d1b8ff8c4ddf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / findlog-1.0.0-py3-none-any.whl

Download URL findlog-1.0.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d153a8dc0c7089ed87f959305d82e95c1a9cf0988bb0b6dda5314d90618642f
BLAKE2b-256 checksum
How to use checksums
492836d29cb74c4c5ab853a279e6ede8c16b5d5c68f2bb07734ae5812fcd7981
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Security for findlog 1.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for findlog-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

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

1.0.0 This release

2 release files Full 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