update Forwarder

This commit is contained in:
rootkit
2025-12-29 02:56:12 +08:00
parent 40d19f5b1b
commit 9722e2df02
3 changed files with 23 additions and 36 deletions
-32
View File
@@ -1,32 +0,0 @@
# Webhook Forwarder Service
This is a standalone FastAPI service that listens for webhooks from various sources (like Splunk, Kibana) and forwards them to a Redis stream.
## Installation
This service has its own dependencies, listed in `requirements.txt`. It is recommended to use a dedicated virtual environment.
1. Navigate to the project root directory.
2. Install the dependencies:
```bash
pip install -r PLUGINS/Forwarder/requirements.txt
```
## Running the Service
You can run the service using `uvicorn`. From the project root directory, execute the following command:
```bash
uvicorn PLUGINS.Forwarder.main:app --host 0.0.0.0 --port 8001 --reload
```
- `--host 0.0.0.0`: Makes the service accessible from outside its container/machine.
- `--port 8001`: Runs on port 8001 (configurable in `PLUGINS/Forwarder/CONFIG.py`).
- `--reload`: Automatically restarts the server when code changes are detected. Ideal for development.
## API Endpoints
- `GET /`: A simple health check endpoint.
- `POST /api/v1/webhook/splunk`: Accepts Splunk alert webhooks.
- `POST /api/v1/webhook/kibana`: Accepts Kibana (Elasticsearch) alert webhooks.
- `POST /api/v1/webhook/nocolymail`: Accepts NocolyMail webhooks.
-4
View File
@@ -1,4 +0,0 @@
fastapi
uvicorn[standard]
redis
pydantic
+23
View File
@@ -0,0 +1,23 @@
# PLUGINS/Forwarder/uvicorn.toml
[server]
# Path to the FastAPI application: module_name.variable_name
# This assumes the uvicorn command is run from the project root.
app = "PLUGINS.Forwarder.main:app"
# Host address to listen on
host = "0.0.0.0"
# Port to listen on. This should match the port defined in PLUGINS/Forwarder/CONFIG.py (8001)
port = 8001
# Number of worker processes. For production, consider using multiple workers
# (e.g., workers = 2 or more, depending on your server's CPU cores).
workers = 1
# Log level. Set to "info" or "warning" for production to reduce verbosity.
log_level = "info"
# Disable auto-reloading for background/production environments.
# Set to true for development if you want the server to restart on code changes.
reload = false