Configuring log rotation
Available in Informer 2025.2.9 and later.
Informer has built-in log rotation that manages log file size and retention automatically, keeping the server healthy and Elasticsearch uninterrupted. It rotates logs by size and/or date, lets you cap how many archives are kept, and can compress them.
Configuration
Log rotation is off by default. To enable it, set logDestination to file in the Informer config and adjust logFile:
"logDestination": "file",
"logFile": {
"logDirectory": "logs",
"maxSize": "20m",
"maxFiles": "14d",
"zippedArchive": true,
"filename": "informer5-%DATE%.log",
"datePattern": "YYYY-MM-DD",
"instanceIdVar": "NODE_APP_INSTANCE"
}
When logDestination is stdout (the default), logs go to standard output and all logFile settings are ignored.
Parameters
| Parameter | Default | What it does |
|---|---|---|
logDestination | stdout | Set to file to enable log rotation; stdout sends logs to standard output and ignores the settings below. |
logDirectory | logs | Subdirectory for log files, relative to the Informer data directory. |
maxSize | 20m | Size at which a log file rotates. Use a unit suffix (20m, 500k, 2g) directly after the number, or raw bytes as a number (20971520). |
maxFiles | 14d | How many archives to keep. Use a days suffix (14d, 30d) or a raw count (10 keeps the last 10 files). If unset, nothing is removed. |
zippedArchive | true | Whether to gzip rotated logs to .gz. |
filename | informer-%DATE%.log | Filename template. Must include %DATE%. In cluster mode the instance ID is appended (for example informer-2025-02-19-0.log). |
datePattern | YYYY-MM-DD | Date format for %DATE%, which also sets how often logs rotate: YYYY-MM-DD daily, YYYY-MM-DD-HH hourly, YYYY-MM monthly. |
instanceIdVar | NODE_APP_INSTANCE | The environment variable holding the PM2 instance ID in cluster mode, so each worker logs to its own file. PM2 sets NODE_APP_INSTANCE by default; match this to your PM2 instance_var if you customized it. Valid values: NODE_APP_INSTANCE or INSTANCE_ID. |