Filebeat Directly to Els or Via Logstash?

Better Stack Team
Updated on November 18, 2024

Whether to send Filebeat data directly to Elasticsearch (ES) or through Logstash depends on your specific requirements, including the complexity of data processing, performance considerations, and infrastructure setup. Here’s a breakdown of the advantages and considerations for both approaches:

Filebeat Directly to Elasticsearch

Advantages:

  1. Simplicity:
    • Direct Connection: Simplifies your setup by reducing the number of components. Filebeat sends data directly to Elasticsearch without intermediate processing.
    • Easier Configuration: Fewer components to configure and manage.
  2. Performance:
    • Lower Latency: Reduces the time between log collection and indexing in Elasticsearch.
    • Resource Efficiency: Less overhead since there’s no intermediate processing layer.
  3. Scalability:
    • Straightforward Scaling: Easy to scale by adding more Filebeat instances without worrying about Logstash bottlenecks.

Considerations:

  1. Limited Processing:
    • Basic Processing Only: Filebeat’s processing capabilities are limited to basic tasks like multiline handling, filtering, and simple data enrichment.
  2. Flexibility:
    • Less Flexible: Limited in terms of complex data transformation and enrichment. For more complex needs, direct integration may not be sufficient.
  3. Error Handling:
    • Direct Errors: Any issues in data ingestion or processing in Elasticsearch will directly impact the data being sent from Filebeat.

Filebeat via Logstash

Advantages:

  1. Advanced Processing:
    • Complex Transformations: Logstash provides advanced filtering, parsing, and transformation capabilities. This is useful for enriching, transforming, and processing logs before they reach Elasticsearch.
    • Enrichment: You can enrich logs with additional data, such as GeoIP information, or perform complex parsing using grok filters.
  2. Flexibility:
    • Integration: Logstash can integrate with various input sources, filters, and output destinations. It provides a more flexible and powerful pipeline for log processing.
    • Routing and Aggregation: You can use Logstash for routing logs to different indices or Elasticsearch clusters based on specific criteria.
  3. Buffering and Resilience:
    • Buffering: Logstash can buffer logs before sending them to Elasticsearch, helping to manage spikes in log volume and providing some level of resiliency.

Considerations:

  1. Complexity:
    • Additional Component: Adds complexity to your stack, requiring configuration and management of both Filebeat and Logstash.
    • Resource Usage: Logstash consumes more resources (CPU and memory) compared to Filebeat alone.
  2. Performance Overhead:
    • Increased Latency: Adds some latency due to the additional processing layer between Filebeat and Elasticsearch.
    • Potential Bottlenecks: If not properly managed, Logstash can become a bottleneck, especially under high log volume.
  3. Maintenance:
    • More Maintenance: Requires ongoing maintenance of Logstash pipelines and handling any issues that arise in the Logstash layer.

Summary

  • Use Filebeat Directly to Elasticsearch if you need a simpler, lower-latency setup and can manage with basic data processing. This is ideal for straightforward log collection and forwarding where advanced processing is not required.
  • Use Filebeat via Logstash if you require advanced log processing, enrichment, or transformation before indexing into Elasticsearch. This setup is suitable for complex environments where logs need significant pre-processing.

Your choice will depend on the complexity of your log processing needs and your infrastructure setup. In many cases, organizations use both approaches: Filebeat for simple log collection and forwarding, and Logstash for more advanced processing and enrichment.

Got an article suggestion? Let us know
Explore more
Licensed under CC-BY-NC-SA

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github