# เลือกใช้ Fluentd หรือ Fluent Bit ดี?

**URL:** <https://discuss.dataengineercafe.io/t/fluentd-fluent-bit/160>\
**Category:** พูดคุยเกี่ยวกับ Data Tools ต่าง ๆ\
**Tags:** kubernetes, logging\
**Created:** [April 5, 2022, 9:45am UTC](https://discuss.dataengineercafe.io/t/fluentd-fluent-bit/160 "2022-04-05T09:45:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![atb](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dataengineercafe.io/atb/32/8_2.png) [@atb](https://discuss.dataengineercafe.io/u/atb)\
**Post date:** [April 5, 2022, 9:45am UTC](https://discuss.dataengineercafe.io/t/fluentd-fluent-bit/160/1 "2022-04-05T09:45:04Z")

</div>

# Fluend vs Fluent Bit

TLDR;

> **Fluent Bit** กับ **Fluentd** แทบจะเหมือนกัน, **Fluent Bit** ครอบคลุมการใช้งานทั่วไปและมีขนาดเบากว่ามาก แต่ถ้าใช้งานท่ายาก **Fluentd** จะครบเครื่องกว่า

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/dataengineercafe/original/1X/2184fb93c2465901cce923ed5a4c418135c71917.jpeg)

> **Fluentd** is an open source data collector, which lets you unify the data collection and consumption for a better use and understanding of data.
> 
> [fluentd.org](https://www.fluentd.org/)

> **Fluent Bit** is a super fast, lightweight, and highly scalable logging and metrics processor and forwarder. It is the preferred choice for cloud and containerized environments.
> 
> [fluentbit.io](https://fluentbit.io/)

จากข้างต้นจะเห็นได้ว่า **Fluentd** และ **Fluent Bit** มีความคล้ายคลึงกันมาก

ทั้ง **Fluentd** และ **Fluent Bit** สามารถทำงานเป็น aggregator และ forwarder ได้ทั้งคู่ด้วยตัวของมันเอง

ด้วย **Fluent Bit** (2014) ถูกสร้างขึ้นบนพื้นฐานต่าง ๆ ของ **Fluentd** (2011) ทั้ง architecture และ general design ทำให้ได้รับแนวคิดที่ดีที่สุดจาก **Fluentd**

และปัจจุบัน (2022) [issues](https://github.com/fluent/fluent-bit/issues) ต่าง ๆ ที่เคยเป็นจุดด้อยของ **Fluent Bit** ก็ได้รับแก้ไขไปเป็นจำนวนมากแล้ว

หรือพูดง่าย ๆ คือ

# Fluent Bit ครอบคลุมการใช้งานทั่วไปและมีขนาดเบากว่ามาก แต่ถ้าใช้งานท่ายาก Fluentd จะครบเครื่องกว่า

🕊

ทั้งนี้ทั้งนั้น การเลือกใช้ขึ้นอยู่กับความเหมาะสมและ trade-offs ต่าง ๆ

_ตารางเปรียบเทียบในด้านต่าง ๆ_

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/dataengineercafe/original/1X/b8095a07c14f92e7a1278ef5baca404862cf16be.png)

**Fluentd** มี plugins เยอะมากกก

_Reference: [Fluentd and Fluent Bit | Fluent Bit: Official Manual](https://docs.fluentbit.io/manual/about/fluentd-and-fluent-bit)_

---

<div class="post-metadata">

**Author:** ![worajedt](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dataengineercafe.io/worajedt/32/208_2.png) [@worajedt](https://discuss.dataengineercafe.io/u/worajedt)\
**Post date:** [April 5, 2022, 10:35am UTC](https://discuss.dataengineercafe.io/t/fluentd-fluent-bit/160/2 "2022-04-05T10:35:26Z")

</div>

น่าสนใจครับ กำชังจะชองเอามาฟีด web log เข้า elasticSearch อยู่เลย

พอมีประสบการณ์ไหมครับ ถ้านับความเร็ว หรือปริมาณข้อมูลแบบไหนที่เป็น cut point ว่าใช้ fluent bit เถอะ fluentd ไม่ไหวแล้ว

---

<div class="post-metadata">

**Author:** ![atb](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dataengineercafe.io/atb/32/8_2.png) [@atb](https://discuss.dataengineercafe.io/u/atb)\
**Post date:** [April 5, 2022, 10:56am UTC](https://discuss.dataengineercafe.io/t/fluentd-fluent-bit/160/4 "2022-04-05T10:56:36Z")

</div>

จุด cut point น่าสนใจมากครับ ส่วนนี้ผมยังใหม่อยู่ ขอรอฟังจากผู้มีประสบการณ์ด้วยคนครับ 😅

อีกหนึ่งจุดที่น่าสนใจคือใน document ของ Amazon EKS เรื่อง [Send logs to CloudWatch Logs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Container-Insights-setup-logs.html) แนะนำให้ใช้ **Fluent Bit** เนื่องจากมีประสิทธิภาพมากกว่าและอาจจะไม่ support **Fluentd** ในอนาคตแล้วครับ

> _We strongly recommend that you migrate to use FluentBit with Container Insights whenever possible. Using FluentBit as the log forwarder for Container Insights provides significant performance gains._

---

<div class="post-metadata">

**Author:** ![zkan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dataengineercafe.io/zkan/32/2_2.png) [@zkan](https://discuss.dataengineercafe.io/u/zkan)\
**Post date:** [April 5, 2022, 11:16am UTC](https://discuss.dataengineercafe.io/t/fluentd-fluent-bit/160/5 "2022-04-05T11:16:04Z")

</div>

แอบแท็กพี่เหน่ง @Nengchakun เผื่อเคยลองเทียบกันระหว่าง Fluentd กับ Fluent Bit ครับ 😄

---

<div class="post-metadata">

**Author:** ![Nengchakun](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dataengineercafe.io/nengchakun/32/201_2.png) [@Nengchakun](https://discuss.dataengineercafe.io/u/Nengchakun)\
**Post date:** [April 5, 2022, 6:18pm UTC](https://discuss.dataengineercafe.io/t/fluentd-fluent-bit/160/6 "2022-04-05T18:18:38Z")

</div>

เล่าที่ทำคร่าวๆ ครับ

1. input เป็น log files จาก containers ที่ deploy บน k8s
2. parser เป็น pre-defined log ต่างๆ เช่น nginx, ambassador, envoy, json และ custom เอง
3. output เป็น kafka

ตอนแรกเคยพิจารณา fluent bit คับ แต่เจอว่าตอนนั้นยังทำ custom parser ด้วย regex ไม่ได้ เลยกลายเป็นถูกบังคับต้องใช้ fluentd เท่านั้น

ตอนนี้ พอได้มารีวิวคร่าวๆ พบว่า function พื้นฐานเหมือนจะเพียงพอต่องานที่พี่ต้องทำแล้ว น่าสนใจมาก ที่จะเอามาใช้งาน เพื่อลด resource เพราะเจอเคส memory บวมเรื่อยๆ เพราะหลักๆ มันเป็น ruby แต่ถ้าใช้ c อาจจะช่วยให้ mem ลด

แต่สิ่งที่น่ากลัวคือ ตอน debug คับ พี่ว่า debug ด้วย ruby ที่เป็น interpreter เบาแรงกว่า c ครับ พอดีพี่มี custom gem ปรับไปด้วย

อีก 1 ประเด็นคือท่า scaling ของ fluentbit ทำยังไง? อันนี้ยังหา doc ไม่เจอคับ  
เล่าในมุม fluentd ละกัน คือมันมีระบบ supervisor แตกเป็น process หลายๆ process ใน process หลักอีกที เลยทำให้มี parallel processing ได้

พี่ว่าพี่ต้องเอาไปลอง พี่อยากรู้ว่าถ้า fluent bit ขายว่าเล็ก และ High Performance และมันจะพอกับงาน scale ที่พี่ทำไหม ไว้ลองแล้วจะเอามาเล่าให้ฟังคับ

สรุป ไม่มี cut point ให้ครับ 5555  
แต่ถ้าเอา idea พี่นะ ให้เริ่มที่ fluentbit ไปเลย function พื้นฐาน ดูแทบจะตอบโจทย์แทบจะทุกโจทย์แล้ว  
ถ้าปัญหาเยอะ แล้วไม่มี concern เรื่อง memory ค่อยย้ายไป fluentd
