Metadata-Version: 2.4
Name: logreach
Version: 0.1.0
Summary: Filter logfiles by timestamp and detect the log type of files in a directory
Author-email: AIT Austrian Institute of Technology GmbH <aecid@ait.ac.at>
Maintainer-email: Wolfgang Hotwagner <aecid@ait.ac.at>
License-Expression: EUPL-1.2
Project-URL: Homepage, https://github.com/ait-testbed/logreach
Project-URL: Documentation, https://ait-testbed.github.io/logreach/
Project-URL: Issues, https://github.com/ait-testbed/logreach/issues
Project-URL: Source, https://github.com/ait-testbed/logreach
Keywords: logs,log analysis,forensics,syslog,auditd,timestamp,filter
Requires-Python: >=3.14
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: python-dateutil>=2.9.0.post0
Requires-Dist: rich>=15.0.0
Dynamic: license-file

# Logreach

Reach into collected log dumps: `logreach` detects the type of each logfile (syslog, audit,
access or JSON) and prints the lines within a time window.

> **Important:** Logreach is an early proof of concept and under development.

## Installation

Requires Python >= 3.14.

From PyPI:

```bash
uv tool install logreach # or pip install logreach   
logreach --help
```

From source:

```bash
git clone https://github.com/ait-testbed/logreach.git
cd logreach
uv run logreach --help
```

When running from source, prefix the commands below with `uv run`.

## Usage

```bash
# all lines of one logfile, type detected automatically
uv run logreach /var/log/syslog

# only the lines between two timestamps
uv run logreach /var/log/syslog --begin '2026-09-01 14:00' --end '2026-09-01 15:00'

# every logfile below a directory
uv run logreach gather/logs --begin '2026-09-01 14:00' --end '2026-09-01 15:00'

# one line per log line, "timestamp path:lineno:line" (timestamp in UTC), e.g. to sort all files by time
uv run logreach gather/logs --begin '2026-09-01 14:00' --plain | sort

# only show the detected type of each file and the problems found
uv run logreach gather/logs --check

# also ask for the type of each file that is not detected, and save the answers in logtypes.json
uv run logreach gather/logs --check --interactive
```

Files where no type fits and lines without a timestamp are listed on stderr at the end of the
run (exit code 1). See `logreach --help` for all options and the
[documentation](https://ait-testbed.github.io/logreach/) for more examples.

### Configuration files

Both are read from the current directory and created empty if missing:

- `ignore_list.txt`: one regex per line; matching paths are skipped when reading a directory.
- `logtypes.json`: one JSON object per line that sets the type of a file instead of detecting it
  (`--check --interactive` writes it for you):

  ```json
  {"logfile_path": "gather/logs/zm/web_php.log", "type": "syslog", "datetimeregex": "\\A(.+?UTC)"}
  {"logfile_path": "gather/logs/suricata/suricata.log", "type": "syslog", "dayfirst": true}
  ```

## Contributing

See [CONTRIBUTING.md](https://github.com/ait-testbed/logreach/blob/main/CONTRIBUTING.md).

## Security
see [SECURITY.md](https://github.com/ait-testbed/logreach/blob/main/SECURITY.md).

## License

[EUPL-1.2](https://github.com/ait-testbed/logreach/blob/main/LICENSE.md)
