Skip to content

Commit 86d6881

Browse files
authored
Add logrotate documentation (#240)
Add description of `logrotate` feature introduced in syslog-ng/syslog-ng#5191.
2 parents 2e512f2 + 6317ce5 commit 86d6881

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

doc/_admin-guide/070_Destinations/040_File/000_File_destination_options.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,41 @@ without specifying an attribute: group().
6464

6565
{% include doc/admin-guide/options/local-time-zone.md %}
6666

67+
## logrotate()
68+
69+
*Description:* This option enables to rotate log files based on their size. The number of rotations and maximum filesize are set via a parameter list.
70+
It has the following suboptions:
71+
72+
### enable()
73+
74+
| Type:| yes/no|
75+
|Default:| no|
76+
77+
*Description:* Enable or disable logrotate feature.
78+
79+
### size()
80+
81+
| Type:| positive number (bytes)|
82+
|Default:| 1MB|
83+
84+
*Description:* Maximum filesize that should trigger logrotation.
85+
86+
### rotations()
87+
88+
| Type:| positive number|
89+
|Default:| 1|
90+
91+
*Description:* Maximum number of rotated files. This number does not include the *main* log file, meaning if this option is set to a number N then at most N+1 files are created.
92+
Rotated files are named based on the given log file name and the their rotation id (`<file-name>.<id>`).
93+
94+
### Example: logrotate()
95+
An example to enable logrotation with a maximum filesize of 500KB and 5 rotations:
96+
97+
```config
98+
file("/var/log/my-logfile.log" logrotate(enable(yes), size(500KB), rotations(5)));
99+
```
100+
This configuration snippet results in at most 6 files (/var/log/my-logfile.log, /var/log/my-logfile.log.1 ... /var/log/my-logfile.log.5).
101+
67102
{% include doc/admin-guide/options/log-fifo-size.md %}
68103

69104
{% include doc/admin-guide/options/mark-freq.md %}

0 commit comments

Comments
 (0)