跳转到内容

file-log

此内容尚不支持你的语言。

The file-log plugin writes request logs to files for persistent storage.

  • Phase: Log
  • Purpose: Write request logs to files
  • Behavior: Creates append-only log files
{
"pluginName": "file-log",
"config": {
"path": "/var/log/minigateway/access.log",
"format": "json",
"rotate": true,
"maxSize": "100MB",
"maxFiles": 10
}
}
OptionTypeDefaultDescription
pathstringRequiredLog file path
formatstringjsonOutput format: json, text
rotatebooleanfalseEnable file rotation
maxSizestring10MBMax file size before rotation
maxFilesnumber5Number of rotated files to keep

When rotate is enabled:

  1. Log file grows until maxSize
  2. File is renamed: access.logaccess.log.1
  3. New file created at original path
  4. Old files beyond maxFiles are deleted

File logs can be processed by:

  • Logrotate: System-level rotation
  • Logstash: ELK stack ingestion
  • Grafana Loki: Promtail ingestion
  • Fluentd: Log forwarding

Ensure the gateway process has write permissions:

Terminal window
mkdir -p /var/log/minigateway
chmod 755 /var/log/minigateway