🔠Want to centralize and monitor your logs?
Go to Logtail and start your log management in 5 minutes.
Fluentd offers the capability to set up log rotation, particularly useful when managing large volumes of logs that consume significant disk space. This feature can be configured through Fluentd's system-wide settings.
Here is an example of a log rotation configuration in Fluentd that can rotate logs daily:
<system>
<log>
rotate_age 7
rotate_size 1048576
</log>
</system>
The configuration options are as follows:
rotate_age
: This parameter specifies the maximum age of log files in days before they are rotated. In this example, logs older than seven days will be rotated.
rotate_size
: This option defines the maximum file size in bytes for a log file before it gets rotated. Here, the file size threshold for rotation is set at 1MB.
Additionally, the rotate_age
option can accept string values for more dynamic scheduling:
<system>
<log>
rotate_age weekly
rotate_size 1048576
</log>
</system>
Setting rotate_age
to "weekly" means that the files will be rotated every week.
These settings are not limited to configuration files. You can also pass them as command-line arguments:
fluentd -c fluent.conf --log-rotate-age 7 --log-rotate-size 104857600
Go to Logtail and start your log management in 5 minutes.
Here is how you can add tags to Fluentd events. Let's assume you configured Fluentd to process Nginx access logs from the access.log file with a source configuration like this: @type tail pa...
Conditional statements can be seamlessly integrated into Fluentd's record_transformer plugin. Here’s how you can do it: @type recordtransformer enableruby true is_successful ${record["s...
Fluentd, starting from version v1.13.0, allows the integration of environment variables within its configuration using the syntax #{ENV['YOUR_ENV_VARIABLE']}. For instance, if you've defined an env...
To direct logs matching a specific tag to multiple outputs in Fluentd, the @type copy directive can be utilized. Here's an example configuration: @type copy @type file path ...