Source: socprime.com – Author: Oleh P.
@label is a feature that defines multiple processing pipelines within a single instance. Labels allow you to route log data through different pipelines, applying different configurations or processing steps to different kinds of logs.
How @label Works
@label is used to route logs to specific pipelines. For instance, you might want to route logs from different applications or services to different destinations or process them differently depending on the type of log.
@label Usage Example
Here’s an example of how @label is used in a Fluentd configuration file:
Explanation
Inputs:
- @type tcp: Specifies that this input source listens for incoming data over TCP.
- @type http: Specifies that this input source listens for incoming HTTP requests.
Labels:
- Logs from @test-label-001 are routed to the pipeline labeled @test-label-001
- Logs from @test-label-002 are routed to the pipeline labeled @test-label-002.
Outputs:
- Logs from tcp source are printed to stdout in the @test-label-001 pipeline with a filter to add new fields.
- Logs from http source are printed to stdout in the @test-label-002 pipeline without any filter.
When to Use
- Separation of Concerns: Use labels when you want to handle different log sources separately, either for routing to different destinations or applying different processing.
- Performance Optimization: Labels can help optimize performance by allowing you to isolate pipelines, reducing the complexity of a single pipeline.
Key Points
- @label defines a separate pipeline.
- Each pipeline can have its own configuration.
- @label allows you to isolate the processing of different logs in the same Fluentd instance.
Was this article helpful?
Like and share it with your peers.
Related Posts
Original Post URL: https://socprime.com/blog/fluentd-work-with-multiple-log-sources-within-a-single-instance-by-using-label/
Category & Tags: Blog,Knowledge Bits,Fluentd – Blog,Knowledge Bits,Fluentd
Views: 2