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
Read a Kibana JSON log export, write a single pytest module that replays every request and asserts on the response status. Authorization headers and secret-looking body fields get replaced with ***REDACTED*** before they reach the generated file.
Full CLI reference, redaction rules, validation steps, limitations, and CI workflow templates live in REFERENCE.md next to this file.
pip install secure-log2testmethod, url, status, optional duration, headers, body.secure-log2test data/sample_kibana_export.json --output tests_generated.pygrep -c '^def test_' tests_generated.py
grep -E '(authorization|x-api-key).*Bearer\s+[A-Za-z0-9]' tests_generated.py # expect zero matchesexport BASE_URL=https://staging.example.compytest tests_generated.py -vGiven an input entry:
{
"method": "POST",
"url": "/api/v1/users",
"status": 201,
"headers": {"Authorization": "Bearer abc.xyz", "Content-Type": "application/json"},
"body": {"name": "Test", "email": "test@example.com"}
}The generator emits:
def test_post_api_v1_users():
response = requests.post(
f"{BASE_URL}/api/v1/users",
headers={"Authorization": "***REDACTED***", "Content-Type": "application/json"},
json={"name": "Test", "email": "test@example.com"},
)
assert response.status_code == 201, (
f"Expected 201, got {response.status_code}: {response.text[:200]}"
)The Authorization value never leaves the parser intact. The real token is read from AUTHORIZATION env var at run time. The generated module is self-contained: imports os, pytest, requests; nothing else, no conftest.py required.
method or url; check the export.BASE_URL not set: generated module reads it at run time.--max-input-mb higher, or split externally first.Full error-handling tree, redaction-rule reference, and validation commands in REFERENCE.md.
Redaction is a safety net, not a substitute for review. Inspect the generated file before pushing; never commit a suite that includes real production tokens. The pattern errs toward over-scrubbing; full rule list and tuning instructions in REFERENCE.md.
For GitHub Actions / GitLab CI templates that run the converter + suite on every push, see REFERENCE.md section "CI integration".
REFERENCE.md (CLI flags, redaction layer rules, validation, error tree, CI templates).tessl-plugin
evals
scenario-1
scenario-2
secure_log2test
tests