For the complete documentation index, see llms.txt. This page is also available as Markdown.

Ingress Traffic Capture

This guide shows you how to use Qtap to capture ingress (incoming) HTTP traffic to your applications. We'll use a simple Python FastAPI web server as an example, but the same principles apply to any HTTP server.

What You'll Learn

  • Configure Qtap to capture incoming HTTP requests

  • See request headers, bodies, and metadata from client requests

  • Understand the difference between ingress and egress capture

  • Monitor API endpoints your application exposes

Use Cases

Why capture ingress traffic?

  • Debug API requests from clients

  • Monitor what data clients are sending to your endpoints

  • Audit incoming traffic for security analysis

  • Understand client behavior and usage patterns

  • Troubleshoot issues with incoming requests


Prerequisites

  • Linux system with kernel 5.10+ and eBPF support

  • Python 3.7+ installed

  • Qtap installed (see Installation)

  • Root/sudo access


Part 1: The Python Web Server

First, let's create a simple FastAPI web server that we'll monitor.

Install FastAPI and Uvicorn

Create the Web Server

Save this as api_server.py:

Start the Server

In one terminal, start the Python server:

You should see:

The server is now listening on all network interfaces, making it accessible from other containers or machines on your network.


Part 2: Qtap Configuration for Ingress

Now let's configure Qtap to capture incoming requests to our Python server.

Create the Qtap Config

Save this as qtap-ingress.yaml:

Key Configuration Points:

  • direction: ingress - Only captures incoming HTTP requests from the network

  • ignore_loopback: true - We're capturing real network traffic, not localhost

  • level: full - Captures complete request/response including bodies


Part 3: Running Qtap and Testing

Step 1: Start Qtap (Before Making Requests!)

In a second terminal, start Qtap with the ingress config:

Or using the Linux binary:

Step 2: Find Your Host's Network IP Address

Find the IP address of the machine running your Python server:

The IP address before the / is what you'll use (e.g., 192.168.1.100).

Note: You can test from the same machine using its network IP (not localhost), or from a different machine on the same network. Both demonstrate true ingress traffic.

Step 3: Allow Firewall Access (If Needed)

If you have a firewall enabled, allow traffic on port 8000:

Step 4: Generate Test Traffic from Another Host

From another machine on your network (or the same machine using its network IP):

Alternative: Test from the same machine

If you don't have another machine available, you can still test from the same host using its network IP:

Step 5: View Captured Traffic

Check the Qtap logs to see the captured ingress traffic:

What you should see:

Key indicators that it's working:

  • "exe": "/usr/bin/python3" - Python process identified

  • Direction: INGRESS - True incoming traffic from network

  • Source IP: 192.168.1.50 - NOT 127.0.0.1 - This is real network traffic!

  • Destination IP: 192.168.1.100:8000 - Your server's network IP

  • "protocol": "http1" - HTTP protocol parsed correctly

  • ✅ Full request/response bodies visible

  • ✅ Custom headers captured (X-Request-ID)

  • ✅ Latency/duration tracked

Part 4: Configuration Variations

Variation 1: Capture Both Ingress and Egress

To capture both incoming requests AND outgoing requests your Python app makes:

Variation 2: Headers Only (No Bodies)

To reduce output size, capture only headers:

Variation 3: Filter Specific Endpoints with Rules

Capture only POST requests or specific paths using Rulekit:

Variation 4: Production Setup with S3 Storage

For production, send sensitive request/response data to your own S3 bucket:

See Level 4 of the Complete Guide for full S3 setup.


Understanding the Output

What Qtap Captures for Ingress

Event Metadata (anonymized):

  • Source IP and port (client)

  • Destination IP and port (your server)

  • Process information (python, PID, container)

  • Timing (request start, duration)

  • Status code

Object Data (sensitive):

  • HTTP method, path, query parameters

  • Request headers (including custom headers)

  • Request body (JSON, form data, etc.)

  • Response headers

  • Response body

Direction Field Explained

  • INGRESS (incoming): Traffic coming INTO your application

    • Client → Your Python server

    • Shows what clients are requesting

  • EGRESS (outgoing): Traffic going OUT from your application

    • Your Python server → External API

    • Shows what your server is calling


Troubleshooting

Not Seeing Any Traffic?

Check 1: Is your Python server listening on 0.0.0.0?

Check 2: Is Qtap running BEFORE you made requests?

Check 3: Is your Python server actually running?

Check 4: Can clients reach your server?

Check 5: Check Qtap is hooking into Python correctly

Seeing "l7Protocol": "other" instead of "http1"?

This means Qtap captured the connection but couldn't parse HTTP. Possible causes:

  • Python server using HTTPS (TLS) - Qtap should still see it via SSL hooks

  • Traffic is not HTTP

  • Qtap not fully initialized when request was made (wait 6+ seconds)

Too Much Noise from System Traffic?

Add process filters to exclude specific executables:


Real-World Example: API Gateway Monitoring

Here's a practical example for monitoring an API gateway:


Next Steps

Learn More About Ingress Capture:

Production Deployment:

Alternative: Cloud Management:


Cleanup


This guide uses validated configurations. All examples are tested and guaranteed to work.

Last updated