855102087d061e7b70af0e2cbac742d80c83b472
Structured Log Parser
This repository contains a small CLI tool that demonstrates how to parse raw log lines into typed events using Pydantic v2 and LangChain structured output.
Features
- Discriminated union of two event types (
HttpOkEventandHttpErrorEvent). - Uses LangChain’s
PydanticOutputParserto let the LLM return a JSON that is automatically validated by Pydantic. - Example log with mixed 200 and error responses.
- Simple table output for quick inspection.
Installation
pip install -r requirements.txt
Usage
python parse_log.py --log path/to/your.log
If --log is omitted, an example log is used.
Description
Languages
Python
100%