2.7 KiB
2.7 KiB
webfortilog
Flask-based web application that converts WAF log files into aligned text reports or CSV exports.
Features
- Upload a UTF-8 log file where each line is a single record
- Parse shell-style
key=valueandkey="value with spaces"tokens - Support
vendormode with fixed columns andfullmode with dynamic columns - Filter by policy and severity with case-sensitive or case-insensitive partial matching
- Sort by combined datetime or severity ranking
- Preview results in the browser and download the generated file
- Run locally with Flask or in Docker with Gunicorn
Project structure
app/
services/
templates/
tests/
Dockerfile
pyproject.toml
wsgi.py
Local usage
Requirements
- Python 3.12
Install
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Run Container
export FLASK_APP=wsgi.py
export MAX_UPLOAD_SIZE_MB=100
flask run --debug
Open http://127.0.0.1:5000.
Example input file
If you have a local WAF export such as attack_download.log, you can use it as a real example upload.
- Example file:
attack_download.log - Approximate size in the current workspace:
98.5 MiB - The default
MAX_UPLOAD_SIZE_MB=100setting is sized to accept a file of that size
Test
pytest
Docker usage
Build
docker build -t webfortilog .
Run
docker run --rm -p 8000:8000 -e MAX_UPLOAD_SIZE_MB=100 webfortilog
Open http://127.0.0.1:8000.
Docker Compose usage
Start the web app
docker compose up --build web
Compose settings are stored in env. Update that file to change values such as:
SECRET_KEYMAX_UPLOAD_SIZE_MBOUTPUT_DIRECTORY
Run the test suite in a container
docker compose run --rm test
Example usage
Browser upload
- Start the app with
flask run --debugordocker compose up --build web - Open the web UI
- Upload
attack_download.log - Try
vendormode withtextoutput for a readable preview - Try
fullmode withcsvoutput for complete export coverage
Command-line upload example
curl -X POST http://127.0.0.1:5000/convert \
-F "log_file=@attack_download.log" \
-F "mode=vendor" \
-F "output_format=text" \
-F "sort_by=datetime" \
-F "order=asc" \
-F "policy_cs=" \
-F "policy_ci=" \
-F "severity_cs=" \
-F "severity_ci="
Notes
- Temporary output files are written to
instance/outputs - The application does not require a database
- Gunicorn is used as the production WSGI server
- Default upload limit is 100 MiB
- Set
MAX_UPLOAD_SIZE_MBto configure the upload limit in megabytes MAX_CONTENT_LENGTHis also supported as a lower-level byte-based override