Turn a Kibana JSON log export into a runnable pytest suite using the secure-log2test CLI. Use when the user has a Kibana or Elasticsearch JSON export of API traffic and wants a regression suite from production logs, when extracting test cases from staging traffic, when scrubbing auth headers or secret-looking body fields before logs leave the laptop, when bridging Kibana-captured requests into a pytest-based suite for CI, when the user mentions Kibana logs, Elasticsearch JSON export, log-to-test conversion, log replay tests, auth header redaction, PII in logs, or regression tests from production traffic.
92
100%
Does it follow best practices?
Impact
93%
1.00xAverage score across 2 eval scenarios
Passed
No known issues
All notable changes to this project will be documented here. Format is loosely based on Keep a Changelog, and the project follows Semantic Versioning.
ensure_utf8_streams() call at the top of main(). Without it, Windows shells defaulting to cp1252 raise UnicodeEncodeError when a generated test name or parser warning carries non-ASCII bytes (Cyrillic, accented Latin, CJK, emoji). This is the write-side mirror of the v1.0.1 read-side fix for issue #3.tests/test_stdout_encoding.py covering: actual cp1252 to UTF-8 switch with Cyrillic round-trip, io.StringIO no-op path, non-callable reconfigure attribute, raising reconfigure (closed streams or odd wrappers), monkeypatch-replaced stdio, and a parametrize sweep across ASCII / Cyrillic / accented Latin / CJK / emoji. Test suite is now 86 tests.SENSITIVE_HEADERS list: dpop, x-hub-signature, x-hub-signature-256. A DPoP proof JWT (RFC 9449) and webhook HMAC signature headers carry credential material, but their names contain none of the substrings the fallback pattern matches, so without explicit listing they passed through into generated suites unredacted.--max-input-mb now rejects a negative value with a clear argparse error instead of accepting it. 0 still disables the size check on purpose, but a negative number (a typo such as -100 meant as 100) previously fell through the > 0 guard and silently disabled the check, removing the input-size protection without any warning. A new _nonneg_int argparse type validates the flag.headers={...} and json={...} (or data=... for non-JSON bodies) blocks reflecting the original log entry, so the redaction work done at parse time is visible in the output file. Previously the template emitted only method, url, and status, hiding the redacted values from the reader.redact_body) wired into KibanaLogEntry as a Pydantic field validator. Scrubs values whose dict key matches the sensitive-name pattern at any depth: {"password": ...}, {"client_secret": ...}, OAuth {"refresh_token": ...}, nested dicts, lists of dicts.auth|token|secret|key|session|cookie|credential|bearer|password|passwd) for header and body field names that fall outside the static SENSITIVE_HEADERS list. Catches custom names project teams invent (X-Custom-Token, Refresh-Token, etc.).SENSITIVE_HEADERS list: proxy-authenticate, x-csrf-token, x-access-token, refresh-token, id-token, x-amz-security-token.python_repr and tests json_body / string_body for safer rendering of header values and request bodies in generated tests.repr() so any quote, backslash, or curly brace inside an original header or body literal cannot break the generated Python source.encoding="utf-8-sig". On Windows the default file encoding is cp1252, so any input containing non-ASCII characters (Cyrillic, CJK, accented Latin, emoji, etc.) crashed with UnicodeDecodeError before the format check ran. Linux and macOS hid the bug because their default is already utf-8. Closes #3.utf-8-sig accepts both BOM and non-BOM utf-8 inputs, so files saved by Windows tools (Notepad, some Excel CSV exports) load cleanly.hits.hits[]), the parser now raises ValueError with a clear diagnostic instead of silently returning zero entries.line / timestamp / fields keys), the error message points at issue #4 where Loki support is tracked.ValueError with the file path included.tests/test_input_validation.py with eight new test cases: Cyrillic in URL and body, CJK characters in URL, emoji in body, Loki shape detection, plain non-Kibana array, empty object, invalid JSON, utf-8 BOM input. Test suite is now 33 tests, up from 25.First stable release. Public API surface (CLI flags, JSON input shape, generated test layout) is now considered stable. Future minor versions will add features without breaking existing usage.
pyproject.toml with PEP 621 metadata, hatchling build backend, console-script entry point.secure-log2test console command available after pip install -e . or pip install secure-log2test (post-PyPI publish).python -m secure_log2test invocation via __main__.py.secure_log2test/ Python package. core/ moved to secure_log2test/core/. templates/ moved to secure_log2test/templates/.main.py removed at top level; CLI entry now lives in secure_log2test/cli.py.pip install -e ".[dev]") and exercises the installed CLI.secure_log2test.core.parser.secure_log2test.__version__ now reads from installed package metadata via importlib.metadata, so it always matches the wheel version. Previously hardcoded.data/sample_kibana_export.json and run ast.parse on the output.python main.py <kibana_export.json>).data/..tessl-plugin
evals
scenario-1
scenario-2
secure_log2test
tests