Skip to content

Commit 5555ccc

Browse files
authored
Add new builtin method for log rotation (#251)
Issues: syslog-ng/syslog-ng#5541 ## The problem Recently, starting with syslog-ng OSE version *4.10* file destinations acquired new option: `logrotate()`. This PR does three things: - inserts `logrotate()` option usage first in enumeration of log rotate approaches - adds link to log rotation page in the relevant place - fixes typos in top-level **README**. @HofiOne, in the original issue you mentioned: > usage of external logrotators with reload/restart Which I find a bit confusing because I thought that adding `REOPEN` command was done just to avoid reloading/restarting syslog-ng. If I'm wrong here and `syslog-ng-ctl reopen` cannot be used instead of reload/restart, I will remove relevant change in this PR.
2 parents 05fe450 + 5652622 commit 5555ccc

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This repository part contains the source code of `The syslog-ng OSE Administrati
1414

1515
## [Developer guide](https://syslog-ng.github.io/dev-guide/README)
1616

17-
Do you like adding your idea, bug-fix to the fabolous syslog-ng? Help others to do the same, share your knwowledge in the [developer guide](https://syslog-ng.github.io/dev-guide/README).
17+
Do you like adding your idea, bug-fix to the fabulous syslog-ng? Help others to do the same, share your knowledge in the [developer guide](https://syslog-ng.github.io/dev-guide/README).
1818

1919
## [Generated document](https://syslog-ng.github.io/)
2020

doc/_admin-guide/070_Destinations/040_File/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ destination d_file {
4545

4646
**NOTE:** When using this destination, update the configuration of your log
4747
rotation program to rotate these files. Otherwise, the log files can
48-
become very large.
48+
become very large. See Configuring log rotation for available options.
4949
{: .notice--info}
5050

5151
Also, after rotating the log files, reload {{ site.product.short_name }} using the

doc/_admin-guide/180_Best_practices_and_examples/004_Configuring_log_rotation.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,32 @@
22
title: Configuring log rotation
33
id: adm-pract-rotate
44
description: >-
5-
The {{ site.product.short_name }} application does not rotate logs by itself. This chapter
6-
describes how to use {{ site.product.short_name }} for log rotation.
5+
This chapter describes how to use {{ site.product.short_name }} for log rotation, making use of builtin options
6+
and external tools.
77
---
88

9-
Consider the following approaches:
9+
Log rotation is traditionally only applicable to files and, consequently,
10+
to file destination drivers in {{ site.product.short_name }}. Consider the following approaches:
11+
12+
## Use builtin logrotate() option of file destination driver
13+
14+
- It is available starting with {{ site.product.short_name }} version 4.10 or later.
15+
16+
- It is performed based on file sizes.
17+
18+
- No additional configuration files are required - log rotation is configured
19+
with the rest of {{ site.product.short_name }}. For details, see file() destination options.
20+
21+
## Separate incoming logs based on time, host or other information
22+
23+
- It is ideal for central log servers, where regular restart of
24+
{{ site.product.short_name }} is unfavorable.
25+
26+
- Requires shell scripts or cron jobs to remove old logs.
27+
28+
- It can be done by using macros in the destination name (in the
29+
filename, directory name, or the database table name). (For details
30+
on using macros, see Templates and macros)
1031

1132
## Use logrotate together with {{ site.product.short_name }}
1233

@@ -17,26 +38,17 @@ Consider the following approaches:
1738
- Less scripting is required, only logrotate has to be configured
1839
correctly.
1940

20-
- Requires frequent restart ({{ site.product.short_name }} must be reloaded/restarted
21-
when the files are rotated). After rotating the log files, reload
41+
- Starting from {{ site.product.short_name }} version 3.13 or later **syslog-ng-ctl reopen**
42+
must be used to signal file destination drivers to open log files again without stopping
43+
or interrupting the rest of configured log pipes. Alternately, {{ site.product.short_name }} can
44+
be reloaded/restarted when the files are rotated. After rotating the log files, reload
2245
{{ site.product.short_name }} using the **syslog-ng-ctl reload** command, or use
23-
another method to send a SIGHUP to {{ site.product.short_name }}.
46+
another method to send a SIGHUP to {{ site.product.short_name }}
2447

2548
- The statistics collected by {{ site.product.short_name }}, and the correlation
2649
information gathered with Pattern Database, are lost with each
2750
restart.
2851

29-
## Separate incoming logs based on time, host or other information
30-
31-
- It is ideal for central log servers, where regular restart of
32-
{{ site.product.short_name }} is unfavorable.
33-
34-
- Requires shell scripts or cron jobs to remove old logs.
35-
36-
- It can be done by using macros in the destination name (in the
37-
filename, directory name, or the database table name). (For details
38-
on using macros, see Templates and macros
39-
4052
### Example: File destination for log rotation
4153

4254
This sample file destination configuration stores incoming logs in files

0 commit comments

Comments
 (0)