v0.1.3 stream changed from net/http to fasthttp for http and gnet for tcp stream, heartbeat config added

This commit is contained in:
2025-07-01 23:43:51 -04:00
parent a3450a9589
commit a7595061ba
13 changed files with 1134 additions and 1474 deletions

View File

@ -6,107 +6,128 @@
# 2. Environment variables (LOGWISP_ prefix)
# 3. This configuration file
# 4. Built-in defaults
#
# All settings shown below with their default values
# Port to listen on
# Environment: LOGWISP_PORT
# CLI: --port PORT
# Default: 8080
port = 8080
[monitor]
# How often to check for file changes (milliseconds)
# Lower values = more responsive but higher CPU usage
# File check interval (milliseconds)
# Lower = more responsive, higher CPU usage
# Environment: LOGWISP_MONITOR_CHECK_INTERVAL_MS
# CLI: --check-interval MS
# Default: 100
check_interval_ms = 100
# Paths to monitor for log files
# Environment: LOGWISP_MONITOR_TARGETS (format: "path:pattern:isfile,path2:pattern2:isfile")
# Monitor targets
# Environment: LOGWISP_MONITOR_TARGETS="path:pattern:isfile,path2:pattern2:isfile"
# CLI: logwisp [path[:pattern[:isfile]]] ...
# Default: Monitor current directory for *.log files
[[monitor.targets]]
path = "./" # Directory or file path to monitor
pattern = "*.log" # Glob pattern for directory monitoring (ignored for files)
is_file = false # true = monitor specific file, false = monitor directory
path = "./" # Directory or file path
pattern = "*.log" # Glob pattern (ignored for files)
is_file = false # true = file, false = directory
# Additional target examples (uncomment to use):
# # Monitor specific log file
# # Example: Specific file
# [[monitor.targets]]
# path = "/var/log/application.log"
# pattern = "" # Pattern ignored when is_file = true
# path = "/var/log/app.log"
# pattern = ""
# is_file = true
# # Monitor system logs
# # Example: System logs
# [[monitor.targets]]
# path = "/var/log"
# pattern = "*.log"
# is_file = false
# # Monitor nginx access logs with pattern
# [[monitor.targets]]
# path = "/var/log/nginx"
# pattern = "access*.log"
# is_file = false
# # Monitor journal export directory
# [[monitor.targets]]
# path = "/var/log/journal"
# pattern = "*.log"
# is_file = false
# # Monitor multiple application logs
# [[monitor.targets]]
# path = "/opt/myapp/logs"
# pattern = "app-*.log"
# is_file = false
[stream]
# Buffer size for each client connection
# Number of log entries that can be queued per client
# When buffer is full, new messages are skipped (not sent to that client)
# Increase for burst traffic, decrease for memory conservation
# Environment: LOGWISP_STREAM_BUFFER_SIZE
# CLI: --buffer-size SIZE
# Default: 1000
buffer_size = 1000
[stream.rate_limit]
# Enable rate limiting per client IP
# Prevents resource exhaustion from misbehaving clients
# Environment: LOGWISP_STREAM_RATE_LIMIT_ENABLED
# CLI: --rate-limit
# Default: false
[tcpserver]
# Raw TCP streaming server (gnet)
# Environment: LOGWISP_TCPSERVER_ENABLED
# CLI: --enable-tcp
enabled = false
# Sustained requests per second allowed per client
# Clients can make this many requests per second continuously
# Environment: LOGWISP_STREAM_RATE_LIMIT_REQUESTS_PER_SEC
# CLI: --rate-requests N
# Default: 10
requests_per_second = 10
# TCP port
# Environment: LOGWISP_TCPSERVER_PORT
# CLI: --tcp-port PORT
port = 9090
# Maximum burst size per client
# Allows temporary bursts above the sustained rate
# Should be >= requests_per_second
# Environment: LOGWISP_STREAM_RATE_LIMIT_BURST_SIZE
# CLI: --rate-burst N
# Default: 20
burst_size = 20
# Per-client buffer size
# Environment: LOGWISP_TCPSERVER_BUFFER_SIZE
# CLI: --tcp-buffer-size SIZE
buffer_size = 1000
# How often to clean up inactive client rate limiters (seconds)
# Clients inactive for 2x this duration are removed from tracking
# Lower values = more frequent cleanup, higher values = less overhead
# Environment: LOGWISP_STREAM_RATE_LIMIT_CLEANUP_INTERVAL_S
# Default: 60
cleanup_interval_s = 60
# TLS/SSL settings (not implemented in PoC)
ssl_enabled = false
ssl_cert_file = ""
ssl_key_file = ""
# Production configuration example:
# [stream.rate_limit]
[tcpserver.heartbeat]
# Enable/disable heartbeat messages
# Environment: LOGWISP_TCPSERVER_HEARTBEAT_ENABLED
enabled = false
# Heartbeat interval in seconds
# Environment: LOGWISP_TCPSERVER_HEARTBEAT_INTERVAL_SECONDS
interval_seconds = 30
# Include timestamp in heartbeat
# Environment: LOGWISP_TCPSERVER_HEARTBEAT_INCLUDE_TIMESTAMP
include_timestamp = true
# Include server statistics (active connections, uptime)
# Environment: LOGWISP_TCPSERVER_HEARTBEAT_INCLUDE_STATS
include_stats = false
# Format: "json" only for TCP
# Environment: LOGWISP_TCPSERVER_HEARTBEAT_FORMAT
format = "json"
[httpserver]
# HTTP/SSE streaming server (fasthttp)
# Environment: LOGWISP_HTTPSERVER_ENABLED
# CLI: --enable-http
enabled = true
# HTTP port
# Environment: LOGWISP_HTTPSERVER_PORT
# CLI: --http-port PORT (or legacy --port)
port = 8080
# Per-client buffer size
# Environment: LOGWISP_HTTPSERVER_BUFFER_SIZE
# CLI: --http-buffer-size SIZE (or legacy --buffer-size)
buffer_size = 1000
# TLS/SSL settings (not implemented in PoC)
ssl_enabled = false
ssl_cert_file = ""
ssl_key_file = ""
[httpserver.heartbeat]
# Enable/disable heartbeat messages
# Environment: LOGWISP_HTTPSERVER_HEARTBEAT_ENABLED
enabled = true
# Heartbeat interval in seconds
# Environment: LOGWISP_HTTPSERVER_HEARTBEAT_INTERVAL_SECONDS
interval_seconds = 30
# Include timestamp in heartbeat
# Environment: LOGWISP_HTTPSERVER_HEARTBEAT_INCLUDE_TIMESTAMP
include_timestamp = true
# Include server statistics (active clients, uptime)
# Environment: LOGWISP_HTTPSERVER_HEARTBEAT_INCLUDE_STATS
include_stats = false
# Format: "comment" (SSE comment) or "json" (data message)
# Environment: LOGWISP_HTTPSERVER_HEARTBEAT_FORMAT
format = "comment"
# Production example:
# [tcpserver]
# enabled = true
# requests_per_second = 100 # Higher limit for production
# burst_size = 200 # Allow larger bursts
# cleanup_interval_s = 300 # Less frequent cleanup
# port = 9090
# buffer_size = 5000
#
# [httpserver]
# enabled = true
# port = 443
# buffer_size = 5000
# ssl_enabled = true
# ssl_cert_file = "/etc/ssl/certs/logwisp.crt"
# ssl_key_file = "/etc/ssl/private/logwisp.key"