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
findlog server.log --around "Connection refused" --brief
findlog app.log.gz --around "error"
kubectl logs my-pod | findlog - --around "Connection refused"
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 |
--brief |
Short output for chat or tickets |
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.1.0
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 | Actions |
|---|---|---|---|---|
| findlog-1.1.0.tar.gz | 17.3 kB | With provenance | Details for findlog-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| findlog-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for findlog-1.1.0-py3-none-any.whl |
Total release size: 35.1 kB
Release files / findlog-1.1.0.tar.gz
| Download URL | findlog-1.1.0.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
40a483ec6d58859f41c67fd641fe357559d2a8c45d4240a6e7e2b10874a5e7b3
|
|
BLAKE2b-256 checksum How to use checksums |
a62c69e977c382f81de10a13932f739622f84e37160a845b688143ec9dd386f9
|
| 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 logRelease files / findlog-1.1.0-py3-none-any.whl
| Download URL | findlog-1.1.0-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05bbf99368fdcdde3097b7fe5e138252a663d1eb6cd2e81ffbc4f51bd47ad886
|
|
BLAKE2b-256 checksum How to use checksums |
7067e7d4fd055b23829bdcdbde087f4c3bb167985523d1ba6afab87c51a5e4e3
|
| 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 logSecurity for findlog 1.1.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.
Attestation for findlog-1.1.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 logA 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.