Skip to main content

Someone wanted to learn this too, so Grasp built them a personal learning path.

You can keep exploring this one or create your own

Designing a Resilient Security Telemetry Pipeline

Hello! Welcome to the sixth lesson in our course on architecting security products.

In our last lesson, we examined the critical "fail-open vs. fail-close" decision for inline security products that operate on the control path. We saw how this choice represents a fundamental trade-off between security and availability when a component fails.

Today, we shift our focus from the control path to the data path. Modern security relies on analyzing vast amounts of telemetry—logs, events, and metrics—from across an entire technology estate. The systems that collect and move this data are just as critical as the inline tools that block attacks. A failure in this pipeline can leave security teams blind.

This lesson addresses the learning outcome: Design the collection and transport layer of a security telemetry pipeline, addressing backpressure, buffering, and delivery guarantees. We will explore the architectural patterns used to build robust, high-throughput data pipelines that can reliably ingest data from thousands of sources without loss, even in the face of component failures or massive traffic spikes.

1. The Challenge of High-Volume Telemetry

Imagine you need to collect security logs from every server, container, and application in your organization. A simple approach might be to have each source send its logs directly to a central storage system (like Elasticsearch or a data lake) via an HTTP API.

This direct-coupled architecture quickly breaks down at scale. What happens if:

  • The central storage system has a brief outage? All sources must either block, buffer logs locally (and risk filling their disks), or drop the logs.
  • A bug in an application causes a sudden 100x increase in log volume? This spike could overwhelm and crash the central system, affecting data collection from all other sources.
  • The data producers (your applications) generate data much faster than the consumer (your storage system) can index it?

To solve these problems, modern telemetry pipelines introduce a decoupling layer. The standard architectural pattern is to use a distributed message queue. Your background in distributed systems will make the rationale for this very clear.

To establish the first principles of this approach, let's watch a video that designs a distributed message queue from the ground up.

System Design Interview - Distributed Message Queue

The video 'System Design Interview - Distributed Message Queue' lays out the core functional and non-functional requirements for a system designed to decouple producers and consumers. These principles are directly applicable to our security telemetry pipeline.

Please watch the introduction from 00:00 to 03:06. Focus on the distinction between synchronous and asynchronous communication and the key non-functional requirements: scalability, high availability, performance, and durability. These are the pillars of our telemetry transport layer.

As the video explains, by introducing a queue, we decouple the producers of data from the consumers. This allows them to operate at different speeds and makes the entire system more resilient to transient failures.

2. The Telemetry Pipeline Architecture

A typical security telemetry pipeline consists of three main stages:

  1. Collection (Agents): Lightweight agents on each host gather logs and metrics.
  2. Transport (Message Queue): A central, durable queue acts as a buffer and distribution hub.
  3. Processing/Storage (Consumers): Downstream systems like SIEMs, data lakes, or real-time alerting engines consume the data from the queue.

Today, we are focusing on the first two stages: collection and transport.

Fluent Bit Telemetry Pipelines Architecture
This diagram shows the internal stages of a typical collection agent like Fluent Bit. Data flows from inputs, through processing steps, into a buffer, and is then routed to one or more outputs, such as a central message queue.

The Collection Layer: Agents and Buffering

The collection agent's primary job is to efficiently gather telemetry from the local machine and forward it to the transport layer. A key responsibility here is local buffering.

Agents typically use a combination of in-memory and on-disk buffers. This allows them to handle brief network interruptions or unavailability of the downstream transport layer without losing data.

Let's look at a real-world example at massive scale: Meta's Scribe system.

Scribe: Transporting petabytes per hour

This article, 'Scribe: Transporting petabytes per hour,' describes the architecture of Meta's logging pipeline. We'll focus on how they handle collection and buffering at the source.

Read the section titled 'Scribed'. Pay close attention to its role as a local daemon and how it uses local disk as a buffer to handle situations where it can't reach the back-end services.

As the Scribe article illustrates, the Scribed daemon acts as an intermediary on the host. Applications write logs to it quickly, and Scribed takes on the responsibility of reliably forwarding them, using its local disk as a buffer to survive disconnections. This is a fundamental pattern for resilient data collection.

3. The Transport Layer: Durability and Delivery Guarantees

The heart of the pipeline is the transport layer, typically implemented with a system like Apache Kafka, RabbitMQ, or a cloud equivalent like AWS Kinesis. Its purpose is to provide a highly available and durable buffer between the collectors and the consumers.

"Durable" here means that once the transport layer acknowledges receipt of a message, it guarantees that the message will not be lost, even if individual servers in the queue cluster fail. This is achieved through replication.

A crucial design decision when building the pipeline is defining its delivery guarantee. There are three common types:

  • At-most-once: Messages may be lost but are never redelivered. This is fast but unreliable.
  • At-least-once: Messages are never lost but may be redelivered in certain failure scenarios (e.g., a producer sends a message, doesn't get an acknowledgement due to a network timeout, and retries, creating a duplicate). This is the most common guarantee for telemetry pipelines.
  • Exactly-once: Every message is delivered once and only once. This is the most complex to achieve and often comes with performance trade-offs.

To understand these guarantees in more detail, let's refer back to the message queue design video.

System Design Interview - Distributed Message Queue

This segment of the video clearly explains the different delivery guarantees and the trade-offs involved.

Please watch the section from 20:01 to 22:45. Focus on the definitions of at-most-once, at-least-once, and exactly-once delivery.

Implementing Guarantees: A Look inside Kafka

To make this concrete, let's see how you would configure these guarantees in Apache Kafka, a dominant technology in this space. Your choice directly impacts the trade-off between performance and durability.

The key configuration is on the producer (the collection agent) side, specifically the acks setting, which determines how many replicas must confirm a write before the producer considers it successful.

Configuring Apache Kafka® Durability, Availability, and Ordering Guarantees

This video from Confluent, 'Configuring Apache Kafka® Durability, Availability, and Ordering Guarantees,' provides a concise explanation of how producer acknowledgements work.

Please watch the following segments: acks modes (01:02 - 02:51): Understand the difference between acks=0, acks=1, and acks=all and their impact on latency and durability. min.insync.replicas (02:51 - 04:01): See how this server-side setting works with acks=all to enforce a minimum level of replication for every write. Idempotent Producers (05:31 - 09:00): This explains the mechanism (Producer ID + sequence numbers) Kafka uses to prevent duplicates on retries, enabling exactly-once semantics on the producer side. This is a great example of the low-level engineering required for stronger guarantees.

By combining client-side settings (acks) and server-side configurations (min.insync.replicas), you can tune the pipeline to meet the precise durability and latency requirements of your security use case. For critical audit logs, you might choose acks=all to ensure no data is lost. For less critical operational metrics, acks=1 might provide a better balance.

4. Managing Backpressure and Buffering

We've established that buffering happens at both the collection agent and the central transport layer. This is the primary mechanism for managing backpressure—the condition where a downstream component cannot process data as fast as an upstream component is sending it.

A well-architected telemetry pipeline doesn't crash or block its sources under load; it gracefully handles the pressure using its buffers.

The following article provides an excellent, comprehensive overview of these mechanics.

Scaling Observability: Designing a High-Volume Telemetry Pipeline

The article 'Scaling Observability: Designing a High-Volume Telemetry Pipeline' has a section dedicated to these concepts. It synthesizes all the ideas we've discussed into a coherent strategy.

Please read the section titled 'Queuing, Buffering, and Backpressure Management.' Focus on: The role of Kafka as the primary, durable buffer. The distinction between in-memory and on-disk buffers in agents. The trade-off between applying backpressure versus dropping data, and why dropping is often preferred for observability data. The importance of monitoring queue length (consumer lag) as a key health metric.

As the article makes clear, the strategy is multi-layered:

  1. Absorb Spikes: The massive disk-backed buffer in the central message queue (e.g., Kafka) is the main tool for absorbing temporary load spikes or short downstream outages.
  2. Handle Local Failures: The agent's local buffer (memory and disk) handles brief disconnections from the central queue.
  3. Shed Load Gracefully: When all buffers are full—a sign of a sustained overload or major outage—the system must have a strategy. For telemetry, this strategy is almost always to start dropping data at the source. This is a conscious trade-off: losing some visibility is better than impacting the performance or stability of the production applications generating the telemetry.
  4. Protect the System: Finally, as seen in the Scribe article, the central service can enforce quotas and rate limits to protect itself from a single misbehaving user or category monopolizing resources. This is another form of backpressure applied at a macro level.

Conclusion

Designing the collection and transport layer for a security telemetry pipeline is a classic distributed systems design problem. You must architect a system that is scalable, resilient, and provides clear guarantees about data delivery, all while handling spiky, high-volume workloads from a multitude of sources.

Key Takeaways:

  • Decoupled Architecture: Telemetry pipelines use collection agents and a central message queue to decouple data producers from consumers, enhancing resilience and scalability.
  • Multi-Layered Buffering: Buffering occurs at multiple stages—in agent memory, on agent disk, and centrally in the message queue—to absorb transient failures and load spikes.
  • Tunable Delivery Guarantees: You must choose a delivery guarantee (e.g., at-least-once) and implement it via mechanisms like producer acknowledgements (acks) and server-side replication (min.insr).
  • Backpressure Management: Under sustained overload, the preferred strategy is often to gracefully degrade by dropping data at the source, rather than propagating backpressure that could impact production applications. Monitoring consumer lag is critical to detect when the system is falling behind.

Preview of the Next Lesson

We have now designed a robust pipeline to collect raw telemetry and transport it reliably to a central location. But what happens next? This raw data is often in disparate formats and lacks context. To be useful for security analysis, it needs to be processed.

In our next lesson, we will focus on the first stage of consumption: Design a security event processing pipeline for normalization, enrichment with threat intelligence, and routing to consumers like SIEMs.

Can't find a good explanation? Sign up and we'll make it for you

Sign up