file-log
The file-log plugin writes request logs to files for persistent storage.
Overview
Section titled “Overview”- Phase: Log
- Purpose: Write request logs to files
- Behavior: Creates append-only log files
Configuration
Section titled “Configuration”{ "pluginName": "file-log", "config": { "path": "/var/log/minigateway/access.log", "format": "json", "rotate": true, "maxSize": "100MB", "maxFiles": 10 }}| Option | Type | Default | Description |
|---|---|---|---|
path | string | Required | Log file path |
format | string | json | Output format: json, text |
rotate | boolean | false | Enable file rotation |
maxSize | string | 10MB | Max file size before rotation |
maxFiles | number | 5 | Number of rotated files to keep |
File Rotation
Section titled “File Rotation”When rotate is enabled:
- Log file grows until
maxSize - File is renamed:
access.log→access.log.1 - New file created at original path
- Old files beyond
maxFilesare deleted
Usage Example
Section titled “Usage Example”Log Format
Section titled “Log Format”Path Configuration
Section titled “Path Configuration”Integration with Log Analysis
Section titled “Integration with Log Analysis”File logs can be processed by:
- Logrotate: System-level rotation
- Logstash: ELK stack ingestion
- Grafana Loki: Promtail ingestion
- Fluentd: Log forwarding
Permissions
Section titled “Permissions”Ensure the gateway process has write permissions:
mkdir -p /var/log/minigatewaychmod 755 /var/log/minigatewaySee Also
Section titled “See Also”- logger - Console logging
- rate-limit - Rate limiting