<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chi Toan on Medium]]></title>
        <description><![CDATA[Stories by Chi Toan on Medium]]></description>
        <link>https://medium.com/@thisoneshouldbeunique?source=rss-7225726987ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aXkMTJ13-qUGmfHx</url>
            <title>Stories by Chi Toan on Medium</title>
            <link>https://medium.com/@thisoneshouldbeunique?source=rss-7225726987ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 06:58:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thisoneshouldbeunique/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Logging at HF (part 2)]]></title>
            <link>https://engineering.hellofresh.com/logging-at-hf-part-2-70f9531e0280?source=rss-7225726987ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/70f9531e0280</guid>
            <category><![CDATA[fluentd]]></category>
            <category><![CDATA[platform]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[site-reliability]]></category>
            <category><![CDATA[resilience]]></category>
            <dc:creator><![CDATA[Chi Toan]]></dc:creator>
            <pubDate>Mon, 12 Oct 2020 11:23:34 GMT</pubDate>
            <atom:updated>2020-10-12T11:47:48.093Z</atom:updated>
            <content:encoded><![CDATA[<p>Optimisation &amp; Leveraging to a platform service</p><p>TL;DR: As we discussed in<a href="https://engineering.hellofresh.com/logging-at-hf-10b090ef12e8"> part 1 of our logging pipeline</a> series, it is important to choose the proper tool based on business demand, but it is even more important to leverage the benefit of the toolset to improve the experience of HF engineers according to<a href="https://engineering.hellofresh.com/advocating-for-a-product-mindset-within-platform-teams-and-how-we-do-it-at-hellotech-part-1-fc1fbf8ae015"> our platform vision</a>: <em>In other words, establishing more empathy with developers and their experience and creating simple solutions to enable teams to be more autonomous.</em></p><p>In this final part of our logging service optimisation series we will cover:</p><ul><li><em>How to optimise our logging performance to handle hundreds of thousands of events per second</em></li><li><em>How to transform the logging pipeline to a logging platform</em></li></ul><p>Before we jumped into a discussion of optimization we asked each other: How fast is fast enough while being achievable. This was necessary to ensure everyone is aligned on the project’s needs &amp; wants.</p><p>To prevent the endless story for performance optimisation, we defined some key criteria for our logging pipeline</p><ul><li>It must be able to handle [x] thousands of messages per second</li><li>The rate of connection timeout is minimal at 1% in total of [y] request per second</li><li>Each message will be kept in the buffer space for a maximum of 30 seconds before flushing out.</li></ul><h3><strong>Performance optimization</strong></h3><p>This is one of the biggest challenges to both code and architecture. Since we started using FluentD (ruby) we were all aware that sooner or later performance would become a big issue, challenging to negotiate. We started by making a minimum viable product from scratch and then made incremental changes as we progressed. From choosing the Docker base image to FluentD plugin installation step, we carefully researched and tested each step one by one before officially releasing the build image. There are several things we learned during this time.</p><blockquote>1. Multi process workers</blockquote><p>FluentD core functionality is kept updated and supports many popular enhancements, but the plugin is usually outdated. As we wrote in the first post, our logging pipeline has three main components which depend on each other. FluentBit, FluentD and GrayLog (using ES). If any of those components are slow, it will affect the others. For example :</p><p>The relation between FluentD and GrayLog is also important. Let’s say you are using the GELF output plugin on FluentD to send the message into GrayLog following a particular format. If,in the meantime, the GELF plugin only adapts for 1 worker, any effort to apply a multi-worker mechanism like the one introduced<a href="https://docs.fluentd.org/deployment/multi-process-workers#:~:text=By%20default%2C%20one%20instance%20of,a%20separate%20process%20per%20worker."> here</a>, won’t work. Fortunately, our engineering team has<a href="https://github.com/hotschedules/fluent-plugin-gelf-hs/pull/8"> </a>modified the GELF output plugin to make it run with multiple workers and contributed the enhancement back to the <a href="http://Adjust Gelf HS plugin to support multi workers">community.</a></p><blockquote>2. Using headless K8s service instead of Cluster IP</blockquote><p>For now we are deploying FluentBit as a daemonset to make sure logs on every K8s node will be collected. The connection between FluentBit to FluentD is usually TCP through K8s service (ClusterIP) but we figured out you actually can use the headless K8S service to reduce the latency during the transmission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/0*bWu3sXugfxOpPYOB" /></figure><p>If you are worried about how failover should work when one of the FluentD pods goes down, and that FluentBit will continue to send the traffic to the fallen pod, you are right! But, that’s the trade-off between fast &amp; reliable. The way around this is to ensure that every FluentD deployment succeeds. Fortunately, this is achievable with a simple bash script using a K8s rolling strategy and native fluent command line ` — dry-run` combination.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/0*HRxcQAY_AxaGX9QM" /></figure><p>This step was added as a prerequisite before the deployment initialized. This way we can make sure of all the configurations will not cause any downtime to the heart of the logging pipeline.</p><blockquote>3. Deprecate the unnecessary DNS traffic.</blockquote><p>As you may already know the common issue when running a high load K8s system is DNS. Every operation which happens inside the K8s cluster requires 1–2 DNS queries. There are already a few potential solutions which were applied on our K8s cluster. One was to use NodeLocalDNS but from our perspective, if our pod can reduce the amount of unnecessary DNS traffic we should do it.</p><p>From FluentD to FluentBit, we are taking full advantage of using environment variables inside the pod to configure the endpoint for outgoing traffic. As K8s documentation explained, you can entirely use whatever information from `printenv` as a source of destination service endpoint.</p><blockquote>4. Tainted or not tainted</blockquote><p>At HelloFresh, our infrastructure relies heavily on key Kubernetes features. One of the main tools from which we benefit is the K8s Scheduler. The scheduler is at the heart of K8s architecture. Any pod can be continuously rescheduled to different nodes as needed to manage loads across the entire cluster . However, for the FluentD service we set them to run permanently on a specific node group. There are 2 main rationale here</p><ul><li>We want to reduce the number of hops between FluentD and GrayLog as much as possible. So, scheduling those critical pods on the same ec2 instance makes sense.</li><li>TCP — Conntrack for such high traffic throughput will need to be tuned differently compared to other traditional HelloFresh services. Separating them to apply TCP settings will be more convenient.</li></ul><p>In general, with those 4 improvements as described above, our logging pipeline has now been empowered to handle over 10k log events per second. We acknowledged there are several important things to consider, such as:</p><ul><li>Build and release the logging library for all our applications because standardizing everything is a main goal we aim to bring across HF. With our own logging library we firmly believe that each logging event will have more meaning for every engineer.</li><li>FluentD (Ruby) is a good choice for now but in the near future with a dozen new logging product releases, we look forward to replacing it with other products that bring us more powerful and easy ways to maintain rather than stick with 1 solution forever. Yet the core architecture should not be changed. The comfort of 3 layers (Collector — Router — Storage) exceeded our expectations.</li></ul><p><em>Before going to the last part, I would like to express my sincere appreciation to my coworkers Mohamed, Vova, William and Ilya who have inspired and kept me in the right direction during the last 5 months</em>.</p><h3>Transforming to Platform service</h3><p>One of the important things that we never had in HF before is letting other developers control their log events. With the new logging infrastructure we aim to let them acknowledge the right visibility into their own application events, and this is the way we have implemented it.</p><blockquote>1. Survey and FeedBack</blockquote><p>Sometimes we receive many questions like: <em>“Why my event is omitted and I can’t see it in GrayLog. </em>Or similarly<em> “How do I send my log to the Graylog endpoint”. </em>From our point of view, those questions are critical points that we needed to solve immediately so I made a small survey to understand what their expectations were. The process was smoothly tackled in a few days and we received a bunch of feedback from all the other engineers. It’s always an honour to see their feedback is aligned with what we are trying to improve. Overall there are several things noted from the survey result:</p><ul><li><em>The configuration and how it works is not visible, thus all engineers could not leverage the configuration to extend what they want to do.</em></li><li><em>How to make sure their events are following the proper format.</em></li><li><em>What if I need to retain our events longer than a few days.</em></li></ul><blockquote>2. FluentD decoupling functionality</blockquote><p>The first and second questions led us to 1 realistic issue as we (SRE) now take main responsibility for the FluentD configuration, there is a document but it is not feasible to other product teams’s knowledge level. So somehow we need to make our configuration more simple and understandable. With that mindset we introduced the FluentD decoupling enhancement.</p><p>Before this solution we usually put all configuration into one value file and used configMap technique to mount the whole config into the FluentD pod.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*idHehlkeONWvcLHC" /><figcaption>From 1 configuration</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/0*gako5vsU_Zo6keL2" /><figcaption>To 1 configMap</figcaption></figure><p>Generating one configuration from one value file with more than 400 lines of code is a severe maintenance challenge. Reading some existing features from the FluentD document page, we realised that `include` syntax will help us reduce significantly the complexity of that config. And this is what we have changed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/0*GWK1kRFMHI0O0Cxn" /><figcaption>Decoupling configs per team</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/0*rKRuWf9uvvPTdupD" /><figcaption>Each of team has own 1 configMap</figcaption></figure><p>With a little bit of configMap and helmChart manipulation we generated config per team to be an individual configMap and mount all of them into the FluentD pod.</p><p>Inside each one of the tribe’s configurations we use goTemplate to make sure the configuration is unmistakable. Ensuring that they will have to define all the required steps for their own events including</p><p>Input — Throttling — Output similarly as in the visualisation below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fIdkxSBuyGzhjKmz" /></figure><p>Using this mechanism, SRE empowered other teams with full capability to leverage and manipulate their own logging pipeline. At the same time we consolidated our logging document to make sure all the features &amp; questions mentioned properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6uDpL9XEKcaCFSdE" /></figure><p>With the reference sheet above, the developers can understand which fields and what kind of the value type of those fields to declare on their log event.</p><p>We keep updating and announce it to broad HelloFresh Engineering organisations monthly.</p><blockquote>3. Retention:</blockquote><p>Logging is important when we have a problem, but more than troubleshooting instantly it also has a big value in letting us investigate the old issues and compare with the recent issues. That’s why our engineers keep asking to retain the log events for more than 2 weeks. Inspired by many cases and situations happening in the last 5 months, SRE decided to split the log of each team into a different ElasticSearch index set. With the different requirements of the team, then we will have proper storage allocation for them. And this is how we achieved that.</p><p>If you remember in part 1, we had mentioned our FluentD has several built in features. One of them is counting. Using the FlowCount plugin we are now able to track 2 important things which any logging platform might need to have</p><ul><li>The total of all log event was sent per pod / container / namespace</li><li>The size of each log event was processed</li></ul><p>FlowCounter is a great plugin to answer these questions. You can see from the picture below that we can easily track how big the log volume is for each namespace per day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S9jpe4qutUJUUcmO" /></figure><p>So the next question is what to do next after we know the total size.</p><p>It is not difficult to figure out the GrayLog index model which we are using now is fully adopted. In fact, instead of Index Set (ElasticSearch) — GrayLog introduces indices as an abstraction between FluentD and ElasticSearch. Indices are the place where we can create and define how big an index set we need and how long we want to keep it. Let’s imagine that we create 10 indices dedicated for 10 name-spaces listed above. Each namespace will have a different size allocation based on the demand of the respective team.</p><p>During several months of observation — We aimed for the high rate of data retention for each namespace (team) and leveraged the size monthly to make sure it always stays updated.</p><p>As the size of each index kept changing, we used GrayLog terraform provider to setup and configure them sequentially. Thankfully, this is a great provider that helped us a lot in building GrayLog.</p><p>Finally leveraging the logging application to platform level brought us more joy every time we worked with logging infrastructure. Some benefits were:</p><ul><li>Logging events are a treasure for all HelloFresh employees; they are maintained by SRE, but we encourage every developer to be aware of their application log’s behaviours. Distributing configuration and decoupling FluentD functions are the way to make it more transparent across the teams and also let them practice on the whole logging pipeline.</li><li>We increased the resilience, robustness and availability of the service to help all colleagues investigate their issues. From optimisation in depth (application layer to infrastructure network) in parallel with a dozen stress tests we have more confidence to let this infrastructure handle HelloFresh log events in the next few months especially during the pandemic time when HelloFresh is experiencing a significant increase in traffic.</li><li>Since all logging filters / parsers are contributed by all engineers, we certainly will have more useful logging events to decrease MTTD and MTTR</li></ul><p><em>Summary</em>: In the past 5 months from the old logging pipeline infrastructure we rebuilt everything from scratch. There are countless lessons we have learned but not mentioned here. However we truly hope with this logging series you will have more visibility for what we are trying to accomplish at HelloFresh. If building something new and bringing more benefits for people is your joy, let’s join us.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70f9531e0280" width="1" height="1" alt=""><hr><p><a href="https://engineering.hellofresh.com/logging-at-hf-part-2-70f9531e0280">Logging at HF (part 2)</a> was originally published in <a href="https://engineering.hellofresh.com/">HelloTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Logging at HF]]></title>
            <link>https://engineering.hellofresh.com/logging-at-hf-10b090ef12e8?source=rss-7225726987ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/10b090ef12e8</guid>
            <category><![CDATA[fluentd]]></category>
            <category><![CDATA[scalability-in-cloud]]></category>
            <category><![CDATA[availability]]></category>
            <category><![CDATA[fluentbit]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Chi Toan]]></dc:creator>
            <pubDate>Mon, 20 Apr 2020 09:15:52 GMT</pubDate>
            <atom:updated>2020-04-20T09:35:15.154Z</atom:updated>
            <content:encoded><![CDATA[<h3>The journey to improving our logging pipeline</h3><p>The Site Reliability Engineering Team at HelloFresh has a clear mission: <em>provide proper visibility for everyone within HelloTech</em>. As our business grows, the team must constantly look at ways to improve our processes around managing hundreds of thousands of log events that come in every second. To manage and adapt to the business needs and scalability required, we chose to re-architect and optimise our logging pipeline. We’ve written about our <a href="https://engineering.hellofresh.com/monitoring-at-hellofresh-part-1-architecture-677b4bd6b728">current monitoring set up</a> before, this article will be focused on the re-architecture, monitoring we implemented, and some challenges along the way.</p><p>Current architecture :</p><p>At HelloFresh, we use 3 main components for logging pipeline: FluentD (collector) + GrayLog (visualisation) to store all data in ElasticSearch. The current architecture was adapted to fit the requirements for all the teams (squads / tribes) at Hello Fresh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/0*l-iDERHI57EaBDaP" /><figcaption>FluentD running model</figcaption></figure><p>This picture shows each of K8s nodes, which have an individual FluentD pod running (daemon set). FluentD runs as a separate container, each of the containers in our K8s nodes log to /var/log/containers/*.log. The container logs are written on the host, FluentD tails the logs and retrieves the messages for each line. We have hundreds of K8s nodes and hundreds of FluentD provisioned for responsibility handling (scrape — parse and push) for all the applications running inside that node.</p><p>In this post, I’ll discuss the steps we took in order to solve the problems outlined below.</p><ol><li><a href="#6084">First</a>, I’ll discuss the Unified Logging Architecture that we implemented.</li><li><a href="#7f3e">Second</a>, like any other critical system at HelloFresh, we needed to implement nuclear monitoring for our logging pipeline. I will discuss the monitoring approach we took for the new architecture.</li><li><a href="#b04d">And finally</a>, I’ll talk about the improvements we made to the logging system in an effort to optimize for abnormal indicators.</li></ol><h3>UNIFIED LOGGING — New Architecture</h3><p>The current architecture has several drawbacks:</p><ul><li>We cannot apply the global rules (eg: throttling) on each of FluentD containers for some particular applications. Because that node may have / have not the application running.</li><li>We want to send these logs to multiple targets either GrayLog or S3 in the near future</li><li>No visibility into how much each log volume from Tribe / Squad is consuming</li></ul><p>Several years ago, Treasure Data proposed the definition of Log Aggregator. Needless to describe the core values of the Aggregator layer. The job of the Aggregator Node is to combine multiple smaller streams into a single data stream that’s easier to process and ingest into the Store, where it’s persisted for future consumption. We have kept that in mind when plan to implement for the new architecture</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/0*Hb4rewo98J2W63TK" /></figure><p>Therefore, the biggest change for the new architecture was implementing the Unified Logging Layer (Fluent Aggregator) and adding more reliability and scalability to data transport. When all the log data starts running through the Unified Logging Layer, it effectively filters, buffers and routes incoming data. Now, we have solved the aforementioned problems and our solution has the following benefits:</p><ul><li>Reliability: We are using a file buffer to store all incoming logs in period time before pushing to the output targets like S3 or GrayLog. From the Grafana dashboard we can easily break down and realise how much data is lost between ingestion &amp; forwarding. It does not matter how you want to send those things together or individually in the meantime</li><li>Flexibility: The aggregator layer now takes main responsibility as a router, thus it won’t be a big deal if we plan to apply new rules for specific application log groups. Also sending those events to the same target or different being more simpler.</li><li>High availability: FluentD aggregators are now running in active and passive either active and active mode. As several times using chaos methodology for the instability testing, We are confident to keep all logs route through the layer as always. The backup mode will automatically handle these fail cases.</li></ul><p>With those conclusions we have implemented the architecture like the image shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fnAUEBBJj23AcA92" /></figure><h3>MONITORING FOR NEW ARCHITECTURE</h3><p>We spent hours manipulating the helm chart to spin up a new aggregator service, this is a part of our standard K8S policy. We now have 2 fluentd aggregator pods running side by side (1 active and 1 passive). Like any other critical systems, we need to gather the golden metrics for observing. So we defined 4 critical metrics need to have on this aggregator:</p><ul><li>Total log sent to aggregator per minute (incoming)</li><li>Total log processed and sent to GrayLog per minute (outgoing)</li><li>How much size of the buffer every minutes</li><li>How many queue pending on Aggregator side</li></ul><p>Fortunately, all these metrics are easily collected by the FluentD prometheus plugin. After that, we came up with some graphs for Grafana.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n9B9Jod1o-XR_Q-8" /></figure><p>Please note that if your FluentD instance is running multiple workers mode, the prometheus port will bind following the total of workers you have. For example, if you set the instance to run 4 workers and prometheus exposes metrics listening at 24231, then they will automatically bind from 24231 → 24234. Therefore, the metric exposed on each port is actually counting for that worker only. Using <em>/aggregated_metrics</em> to scrape metrics from all workers at once.</p><p>And what about the collector side?</p><p>As mentioned above, each of K8S nodes will have 1 FluentD pod running, but they are not configured as aggregators. They are called collectors. From our point of view, all the logic needs to migrate from collector to aggregator. The collector will only have 1 critical mission: to tail and transfer to aggregators. Our collector also enriches every log message with K8S metadata. With the methodology described, we decided to implement monitoring for the collector side with one critical metric: “Connectivity between collector and aggregator”.</p><p>There is no specific metric we can use from the Prometheus plugin to gather this information. The Prometheus plugin does provide one potentially useful metric called <em>output_status_retry_count</em>. Even though we cannot assume this metric entirely relates to connectivity between collector and aggregator, at least it gives fast feedback when abnormal situations occur.</p><p>In general we merged all our maps into a single Grafana dashboard where they show the behaviour of Collector and Aggregator. Beside Grafana dashboard, the prometheus alert is also involved to help us paging whenever logging pipeline unhealthy. But before to define those strict rules to Alert Manager system, our of the pipeline heavily relying on Buffer / Retry Rate / Error Rate . Several hypotheses were raised before those alerting rules were set</p><p>We aim to observe the behaviour and evaluate the health of the pipeline heavily relying on Buffer / Retry Rate / Error Rate . Several hypotheses were raised before setup alerting</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EddKOwKGalISJBRc" /></figure><p>And the final alert were strictly following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vMV56f9v0PO6Adbp" /><figcaption>Alert Manager definition</figcaption></figure><h3>IMPROVEMENTS TO THE NEW ARCHITECTURE — FluentBit to the Rescue</h3><p>Last time we designed the Grafana dashboard, we spent several hours observing the system. There are several issues that force us to rethink FluentD collectors. See image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sCHY9npZ1ctFVeaX" /></figure><p>We used to get a high buffer / failed rate on each of the collectors when high log traffic occurred. Every FluentD instance seemed stuck on collecting new messages and processing the old message. We were aware that it might be related to the buffer configuration, which we have tried to optimise. Simply increasing the parameters during the peak time traffic will be inefficient and not scalable because we cannot foresee when a peak will happen again and we don’t want to trade off resources for those kinds of situations.</p><p>In an ideal world, the logging pipeline platform should be resilient enough to deliver millions of logs without failing. We decided this buffer system was important to solve for now, in order to scale later; and we came up with several ideas:</p><ol><li>Scale up / scale out destination when writing data is slow</li><li>Increase flush_thread_count when the write latency is lower. Launching multiple threads can reduce the latency.</li><li>Improve network setting. If the network is unstable, the number of retries increases and makes buffer flush slow.</li><li>Optimize buffer chunk limit or flush_interval for the destination. For example, kafka and mongodb have different characteristics for data ingestion.</li></ol><p>Option 4 aims to deal with buffer parameters, which we don’t recommend. We will still need to have a proper number to adapt perfectly to each case which is impossible. Option 1 + 2 are feasible, but they would take too much time to improve the current automation and also mess with the HPA mechanism on Kubernetes. Option 3 is something we threw out due to the complexity of the current K8s network.</p><p>Then we asked the following question: <em>do we have any self protect mechanism by FluentD itself to prevent high buffers? </em>Sounds like a queue message!</p><p>After a few days, the team came up with several ideas and implementation plan:</p><ol><li>Use message queues as the primary buffer system, so that the messages will be collected and published into the queues. Aggregator pod can subscribe to every queue one by one and consume each of the messages in time</li><li>Whether we want to use message queues or not we still need to deal with FluentD as an open gateway. Having the proper metrics at this layer to see the data growth frequency is a must. Base on this data collected we can have set the buffer parameter properly (We are using file buffer)</li><li>Another solution is to use FluentBit. Reading the documentation about <em>mem_buf_limit</em> under backpressure we got a better understanding of data processing flow and it seems to be exactly the answer we were looking for the question above.</li></ol><p>Replacing FluentD with FluentBit for collector layer is not a difficult technical challenge, but there are few trade-offs:</p><ol><li>There is no active — standby mode in forwarding like FluentD has. So, if we decided to use FluentBit as a collector layer, and forward all the logs in a balanced manner to FluentD aggregator pods.</li><li>FluentBit is lightweight so it doesn’t have as many plugins as FluentD It means we need to be careful in the future if a need to deal with some specific source input which is not supported will arise.</li><li>FluentBit enrich messages with K8s metadata automatically.</li></ol><p>Below is the architecture with the FluentBit solution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/0*wPmhxmZePbxZjyz6" /></figure><p>Basically, we just replace FluentD at the collector side with FluentBit and configure it to send log messages continuously to the Aggregator layer (FluentD).</p><p>With the new relatively minor change on the collector side, we have achieved the following:</p><ol><li>No high buffer and zero instability network symptoms from Grafana</li><li>Ability to collect and visualise metrics for each layer needed (FluentBit — FluentD — GrayLog — ElasticSearch)</li><li>New architecture is ready to be enhanced with the throttling rules — calculating message size rules.</li><li>All configurations are now managed with HelmChart, which improves the resilience of our infrastructure.</li></ol><h3>Key takeaways</h3><p>At HelloFresh engineering we are encouraged to ask questions as often as possible, iterate and learn to be patient with every unexpected turn. I’ve learned to be ready to change as often as needed.</p><p>Monitoring systems are key to assess the quality either for both critical and non critical services. No single setup will be the right solution forever, so keep improving based on your own questions everyday.</p><p>Using CNCF in your infrastructure may provide flexibility for your architecture, but it leads to hundreds of hidden problems, which will require you to work proactively with the community.</p><p>In part 2 of this article, we will talk about how to optimise these components further and about “must-have” rules to strengthen your logging platform.</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10b090ef12e8" width="1" height="1" alt=""><hr><p><a href="https://engineering.hellofresh.com/logging-at-hf-10b090ef12e8">Logging at HF</a> was originally published in <a href="https://engineering.hellofresh.com/">HelloTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>