Financial Infrastructure · DevOps · Boston

Engineering inside
financial services.

Ten years across private equity, retail, and asset management. Real technical experience covering infrastructure, cloud, security, and trading systems. Written plainly to help other engineers navigate this world.

Michael Harlow
Michael Harlow // sys.ghost  ·  Boston, MA
☕ Buy me a coffee
Latest post
Every engineering org I talk to is running AI agents somewhere in production now. Almost none of them have figured out how to operate them the way we operate everything else that touches customer data.
Jul 14, 2026 · 11 min read
Read →
Latest post
Every engineering org I talk to is running AI agents somewhere in production now. Almost none of them have figured out how to operate them the way we operate everything else that touches customer data.
Jul 14, 2026 · 11 min read
Read →
All posts

Archive

We scheduled a Technology Connect event for our engineering team and built a lineup of games around AI and infrastructure topics. Here's how we put it together and what I'd do differently.
← Back to posts
Infrastructure Apr 14, 2026 · 16 min read

Running Fluent Bit as a Sidecar in Kubernetes for Log Distribution

Running Fluent Bit as a Sidecar in Kubernetes for Log Distribution

This post walks through deploying Fluent Bit as a sidecar container alongside an application in Kubernetes. The sidecar pattern keeps your application container focused on its job while Fluent Bit handles log collection, transformation, and distribution to one or more destinations.

Why a sidecar instead of a DaemonSet

The standard Kubernetes logging setup runs Fluent Bit (or Fluentd) as a DaemonSet: one agent per node, reading container logs from the host filesystem at /var/log/containers/. That works fine for basic log collection.

The sidecar pattern is worth considering when:

  • Your application writes structured logs to a file rather than stdout
  • You need per-application log routing (different apps ship to different destinations)
  • You want log parsing or enrichment specific to one application without affecting the cluster-wide agent
  • You are in a multi-tenant environment and need strong isolation between log streams

The tradeoff is resource overhead. Each pod gets its own Fluent Bit instance instead of sharing one per node.

How it works

The application container and Fluent Bit container share a volume mounted at a common path. The application writes log files to that path. Fluent Bit tails those files, applies any parsing or filtering you have configured, and ships the output to your chosen destinations.

text
Pod
  ├── app-container      (writes to /var/log/app/)
  ├── fluentbit-sidecar  (reads /var/log/app/, ships to destinations)
  └── shared-volume      (emptyDir mounted to both)

Step 1: A simple application that writes log files

For this walkthrough, the application is a minimal Python Flask service that writes structured JSON logs to a file. The same pattern applies to any application.

python
# app.py
import logging
import json
import os
from flask import Flask, request, jsonify

app = Flask(_name_)

LOGPATH = os.environ.get('LOGPATH', '/var/log/app')
os.makedirs(LOGPATH, existok=True)

# JSON file handler
filehandler = logging.FileHandler(f'{LOGPATH}/app.log')
file_handler.setLevel(logging.INFO)

class JSONFormatter(logging.Formatter):
def format(self, record):
return json.dumps({
'timestamp': self.formatTime(record),
'level': record.levelname,
'service': 'my-api',
'message': record.getMessage(),
'path': getattr(record, 'path', None),
'status': getattr(record, 'status', None),
})

filehandler.setFormatter(JSONFormatter())
logger = logging.getLogger()
logger.addHandler(file
handler)
logger.setLevel(logging.INFO)

@app.route('/health')
def health():
return jsonify({'status': 'ok'})

@app.route('/api/data')
def data():
logger.info('request received', extra={'path': '/api/data', 'status': 200})
return jsonify({'data': 'example'})

if _name == 'main_':
app.run(host='0.0.0.0', port=8080)
```

Step 2: The Fluent Bit configuration

Fluent Bit configuration has three main sections: INPUT (where to read from), FILTER (optional transformations), and OUTPUT (where to send).

Create a ConfigMap with the Fluent Bit config:

yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: fluentbit-config
  namespace: my-app
data:
  fluent-bit.conf: |
    [SERVICE]
        Flush         5
        Daemon        off
        Log_Level     info
        Parsers_File  parsers.conf
        HTTP_Server   On
        HTTP_Listen   0.0.0.0
        HTTP_Port     2020

[INPUT]
Name tail
Path /var/log/app/.log
Parser json
Tag app.

RefreshInterval 5
Mem
BufLimit 10MB
Skip
LongLines On
DB /var/log/fluentbit/flb
kube.db

[FILTER]
Name recordmodifier
Match app.*
Record pod
name ${HOSTNAME}
Record namespace ${NAMESPACE}
Record container_name my-api

[OUTPUT]
Name es
Match app.*
Host ${ELASTICSEARCHHOST}
Port 9200
Index app-logs
Type
doc
LogstashFormat On
Logstash
Prefix my-api
Retry_Limit 5

[OUTPUT]
Name s3
Match app.*
bucket ${S3BUCKET}
region ${AWS
REGION}
storedir /tmp/fluentbit-s3
total
filesize 10M
upload
timeout 10m
s3keyformat /logs/my-api/%Y/%m/%d/%H/%M/%S

parsers.conf: |
[PARSER]
Name json
Format json
TimeKey timestamp
Time
Format %Y-%m-%d %H:%M:%S,%L
Time_Keep On
```

A few things worth noting in this config:

DB /var/log/fluentbit/flb_kube.db creates a small SQLite database that tracks the read position in each log file. Without this, a Fluent Bit restart reads the entire file from the beginning and you get duplicate log entries. The database path needs to be on a writable volume.

HTTP_Server On exposes a metrics endpoint at port 2020 on the Fluent Bit container. This is useful for health checks and for scraping Fluent Bit's own metrics with Prometheus.

MemBufLimit 10MB caps how much Fluent Bit buffers in memory per input before applying backpressure. Tune this based on your log volume.

Step 3: The Kubernetes deployment

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-api
  namespace: my-app
spec:
  replicas: 2
  selector:
    matchLabels:
      app: my-api
  template:
    metadata:
      labels:
        app: my-api
    spec:
      volumes:
        # Shared log volume between app and Fluent Bit
        - name: app-logs
          emptyDir: {}
        # Fluent Bit position database (survives container restart, not pod restart)
        - name: fluentbit-db
          emptyDir: {}
        # Fluent Bit config from ConfigMap
        - name: fluentbit-config
          configMap:
            name: fluentbit-config

containers:

# ── Application container ──
- name: my-api
image: registry.example.com/my-api:1.0.0
ports:
- containerPort: 8080
env:
- name: LOG_PATH
value: /var/log/app
volumeMounts:
- name: app-logs
mountPath: /var/log/app
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 256Mi
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
periodSeconds: 15
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
capabilities:
drop: ["ALL"]

# ── Fluent Bit sidecar ──
- name: fluentbit
image: fluent/fluent-bit:3.0
ports:
- containerPort: 2020
name: metrics
env:
- name: ELASTICSEARCHHOST
valueFrom:
secretKeyRef:
name: my-api-secrets
key: elasticsearch-host
- name: S3
BUCKET
valueFrom:
secretKeyRef:
name: my-api-secrets
key: s3-bucket
- name: AWS_REGION
value: us-east-1
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- name: app-logs
mountPath: /var/log/app
readOnly: true
- name: fluentbit-db
mountPath: /var/log/fluentbit
- name: fluentbit-config
mountPath: /fluent-bit/etc
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
memory: 128Mi
livenessProbe:
httpGet:
path: /api/v1/health
port: 2020
initialDelaySeconds: 10
periodSeconds: 30
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
capabilities:
drop: ["ALL"]
```

The readOnly: true on the app-logs volume mount for Fluent Bit is worth emphasising. Fluent Bit only needs to read the log files, not write them. Mounting read-only is a small but correct security boundary.

Step 4: Deploy and verify

Apply the ConfigMap and Deployment:

bash
kubectl apply -f fluentbit-configmap.yaml
kubectl apply -f deployment.yaml

Check that both containers in the pod are running:

bash
kubectl get pods -n my-app
# NAME                      READY   STATUS    RESTARTS   AGE
# my-api-7d9b8c6f4-xkp2n   2/2     Running   0          45s
# my-api-7d9b8c6f4-r9m4q   2/2     Running   0          45s

# READY shows 2/2 - both app and fluentbit are healthy
```

Check Fluent Bit logs:

bash
kubectl logs -n my-app my-api-7d9b8c6f4-xkp2n -c fluentbit

You should see Fluent Bit initialising and starting to tail your log file. If you see errors like [error] [output:es] could not connect to host, check your Elasticsearch connection details.

Hit the application endpoint a few times to generate some logs:

bash
kubectl port-forward -n my-app deployment/my-api 8080:8080

curl http://localhost:8080/api/data
curl http://localhost:8080/api/data
curl http://localhost:8080/api/data
```

Check the Fluent Bit metrics endpoint:

bash
kubectl port-forward -n my-app my-api-7d9b8c6f4-xkp2n 2020:2020

curl http://localhost:2020/api/v1/metrics
```

The output.es.proc_records metric tells you how many records have been successfully sent to Elasticsearch. If it is incrementing, logs are flowing.

Common problems

Fluent Bit starts but no logs appear in the output

First check if Fluent Bit is actually reading the file:

bash
curl http://localhost:2020/api/v1/metrics | python3 -m json.tool | grep proc_records

If input.tail.proc_records is zero, Fluent Bit is not reading any records at all. Check that the log file exists in the shared volume:

bash
kubectl exec -n my-app my-api-7d9b8c6f4-xkp2n -c fluentbit -- ls -la /var/log/app/

If the file is there but proc_records is still zero, check the parser. JSON parsing fails silently if the log lines are not valid JSON. Switch to a dummy parser temporarily to confirm the file tail is working:

text
[INPUT]
    Name    tail
    Path    /var/log/app/*.log
    Tag     app.*

Database file permission errors

If you see [error] could not open database, the Fluent Bit container does not have write permission to the database directory. Since we are running as non-root, the emptyDir volume needs to be writable by the Fluent Bit user.

Fix this with a security context on the volume:

yaml
securityContext:
  fsGroup: 1000

Add this at the pod spec level (not the container level) and Kubernetes will set the group ownership of mounted volumes to 1000.

Log duplication after pod restart

If you are seeing duplicate log entries after a restart, the Fluent Bit database file is not persisting. The emptyDir volume for fluentbit-db is ephemeral. If the Fluent Bit container restarts (not the whole pod), the database survives. If the pod is rescheduled, it is gone.

For persistent position tracking across pod rescheduling, use a PersistentVolumeClaim for the database volume instead of emptyDir. Whether this matters depends on how tolerable duplicate logs are for your use case.

Adding a second output: CloudWatch Logs

One of the advantages of Fluent Bit over simpler solutions is that adding a second output is just adding a config block. To also ship to AWS CloudWatch:

text
[OUTPUT]
    Name              cloudwatch_logs
    Match             app.*
    region            us-east-1
    log_group_name    /kubernetes/my-api
    log_stream_prefix pod/
    auto_create_group true

Fluent Bit will now send every log record to both Elasticsearch and CloudWatch simultaneously. The application container has no knowledge of either destination.

---

The sidecar pattern is more resource-intensive than a DaemonSet but gives you significantly more control over per-application log routing. In environments where different applications have different compliance requirements around log retention or destination, that control is worth the overhead.

Found this useful?
☕ Buy Michael a Coffee
← More posts

Hey, I'm Michael Harlow.

Senior Systems Engineer · Boston, MA · Writing as sys.ghost

I have spent over a decade building and maintaining infrastructure at the intersection of technology and financial services. My career has taken me through three distinct sectors -- technology, private equity, and asset management -- and each one changed how I think about what reliable infrastructure actually requires.

I started in general IT, which is where most engineers who did not go straight into software end up. Data centers, networking, on-call rotations, learning to label cables properly because unlabeled cables are a promise that someone else will suffer later. The work taught me that almost every sophisticated system is, one layer down, a collection of unglamorous fundamentals that either hold or do not. I still believe that. I still label everything.

Private equity came next, and it was a different world. The infrastructure stakes there are less about uptime and more about data integrity. When deal teams are making acquisition decisions based on data you are responsible for, and when a due diligence process has a hard deadline that does not move regardless of what broke overnight, your relationship with reliability changes. A wrong number in an LP report does not cause an immediate incident. It causes a conversation in a partner meeting six weeks later, and by then you need to reconstruct what happened from imperfect records. I became obsessive about data provenance in PE and I have not stopped.

For the past several years I have been in asset management, supporting trading and investment operations infrastructure. This is the environment I find most technically interesting. The compliance requirements are demanding, the legacy systems have long institutional memories, and the tolerance for operational errors is genuinely low -- not just in terms of business impact, but in terms of regulatory consequence. When markets are open, there is no fixing it after the weekend.

I started Packet & Profit in January 2026 because I kept looking for the kind of writing I wanted to read and finding it mostly did not exist. There is a lot of content for engineers online. There is much less written by engineers working specifically inside regulated financial services firms, being honest about what that actually involves day to day. The compliance conversations, the legacy constraints, the incident management in front of stakeholders who measure downtime in dollars per minute. That is what I write about here.

Outside of work I have been running a Saturday morning robotics course at my local YMCA for kids aged 10 to 14. It is one of the better decisions I have made.

Certifications

Red Hat Certified Engineer (RHCE)
Certified Kubernetes Administrator (CKA)
AWS Solutions Architect -- Associate
CompTIA Security+
HashiCorp Vault Associate

My Stack

RHEL / Ubuntu
Kubernetes
OpenShift
Terraform
Ansible
Prometheus
Grafana
Python / Bash
AWS / Azure
Cisco / Palo Alto
PostgreSQL
Redis
HashiCorp Vault
Fluent Bit
Helm
ArgoCD

Career

2022 -- Present
Senior Systems Engineer, Asset Management -- Boston, MA
Leading infrastructure for trading operations and investment management systems. Responsibilities span network security, cloud migration strategy, Kubernetes platform engineering, and incident response. Deeply involved in T+1 settlement infrastructure work and the shift from overnight batch processing to near-real-time event-driven architecture.
2018 -- 2022
Systems Engineer, Private Equity -- Boston, MA
Built and maintained data infrastructure supporting deal teams, portfolio monitoring, and investor reporting. Managed infrastructure through multiple due diligence cycles with hard deadlines and high data integrity requirements. Led a major data platform migration from on-premises to cloud-hosted infrastructure, including security controls satisfying LP and regulatory requirements.
2015 -- 2018
Infrastructure Engineer, Retail Technology
Supported inventory management, real-time pricing, and supply chain integration systems across a high-SKU retail environment. Operated under peak load conditions where scale was a concrete engineering problem rather than an abstract one. Built out monitoring and alerting infrastructure from scratch and managed a full data center relocation.
2013 -- 2015
IT Engineer, Technology Sector
Established the professional fundamentals: data center operations, network infrastructure, endpoint management, and the on-call rotations that teach you more about system fragility than any textbook. Developed an appreciation for cable labeling that has never left me.

Get in Touch

If you are an engineer working in financial services, curious about the career path, or have a question about something I have written, I would genuinely like to hear from you. Use the and I will get back to you. If something here has been useful, a coffee is always appreciated.

A note on anonymity: I write under my own name but keep my current employer private. The financial services industry is small, the regulatory environment is real, and I want to write honestly without those constraints. All incidents and case studies on this site are anonymised. The technical content is real; identifying details are not.
Get in touch

Contact

Whether you are an engineer in financial services, have a question about something I have written, or just want to say hello - feel free to reach out. I read everything.

Powered by Resend · No spam, ever

Legal

Privacy Policy

Last updated: April 2026

This policy explains what information Packet & Profit collects when you visit this site, how it is used, and what choices you have.

Information We Collect

We do not require you to create an account or provide personal information to read this blog. The only personal information we collect is what you voluntarily submit through the contact form: your name, email address, and message. This information is transmitted via Resend and used solely to respond to your enquiry.

Google AdSense and Advertising

This site uses Google AdSense to display advertisements. Google AdSense uses cookies and similar tracking technologies to serve ads based on your prior visits to this and other websites. This means Google may use information about your visits to this site to show you personalised ads on other sites across the web.

You can opt out of personalised advertising by visiting Google Ads Settings, aboutads.info, or optout.networkadvertising.org. See Google advertising policies for more.

Cookies

This site uses a single first-party cookie to remember your theme preference (light or dark mode). This cookie contains no personal information. Third-party cookies may be set by Google AdSense for advertising purposes as described above.

Analytics

This site does not currently use any analytics platform beyond what Vercel provides as part of its standard hosting service (aggregated, anonymised traffic data).

Contact Form

When you submit the contact form, your name, email address, subject, and message are transmitted to the blog author via Resend. This data is not stored by this site and is not shared with any third party beyond Resend. See Resend's privacy policy for details.

Third-Party Links

Posts on this site may link to external websites. We are not responsible for the privacy practices or content of those sites.

Your Rights

If you have submitted a message via the contact form and would like that information removed, or if you have any questions about this policy, please use the contact form to get in touch.

Changes to This Policy

We may update this policy from time to time. The date at the top of this page reflects when it was last revised.

Legal

Terms of Service

Last updated: April 2026

By accessing and using Packet & Profit (packetandprofit.com), you agree to be bound by these Terms of Service. If you do not agree, please do not use this site.

Use of Content

All written content, illustrations, and code examples published on this site are the original work of Michael Harlow unless otherwise stated. You are welcome to share links to posts and quote brief excerpts (with attribution), but you may not reproduce full articles, copy content to other websites, or use the content for commercial purposes without written permission.

No Professional Advice

Content published on this site reflects personal opinions and professional experience. It is provided for informational and educational purposes only. Nothing on this site constitutes financial, investment, legal, or professional advice of any kind. See the for more detail.

Third-Party Links

This site may contain links to third-party websites. These links are provided for convenience and do not constitute an endorsement of the linked site or its content. We have no control over and accept no responsibility for external sites.

Advertising

This site participates in Google AdSense, which displays advertisements from third-party advertisers. The presence of an advertisement does not constitute an endorsement of the advertiser's products or services. Ad content is determined by Google based on the content of this site and your browsing history.

Accuracy of Information

While we make every effort to ensure the accuracy of information published on this site, technology and financial markets change rapidly. Information that was accurate at the time of publication may become outdated. We do not warrant the completeness, accuracy, or timeliness of any content on this site.

Limitation of Liability

To the fullest extent permitted by law, Packet & Profit and its author shall not be liable for any direct, indirect, incidental, or consequential damages arising from your use of, or inability to use, this site or its content.

Changes to These Terms

We reserve the right to update these terms at any time. Continued use of the site following any changes constitutes your acceptance of the revised terms. The date at the top of this page reflects the most recent revision.

Contact

If you have questions about these terms, please use the .

Legal

Disclaimer

Last updated: April 2026

Packet & Profit is a personal blog written by Michael Harlow, a Systems Engineer based in Boston, MA. The views expressed here are entirely his own and do not represent those of any employer, client, or organisation he is affiliated with.

Not Financial or Investment Advice

This site discusses financial services technology, investment management infrastructure, and related engineering topics from a technical practitioner's perspective. Nothing published here is financial advice, investment advice, or a recommendation to buy, sell, or hold any security, asset, or financial instrument. The author is not a registered financial adviser, broker, or investment professional.

Content that references financial markets, trading systems, or investment firms is provided for technical and educational context only. Any figures, case studies, or examples are illustrative and should not be relied upon for financial decisions.

Not Legal or Professional Advice

Nothing on this site constitutes legal, compliance, regulatory, or professional advice. Readers should consult qualified professionals for advice specific to their circumstances.

Professional Experience

Posts on this site draw on the author's professional experience in systems engineering across private equity, retail technology, and asset management. Specific details about employers, clients, projects, and colleagues have been anonymised or generalised. Any resemblance to specific organisations is incidental.

Accuracy

The author makes reasonable efforts to ensure published information is accurate at the time of writing. The technology and financial services landscape changes quickly. Readers should verify any technical or regulatory information against current primary sources before acting on it.

Affiliate Links and Advertising

This site displays advertisements through Google AdSense. The site may also contain links to tools, services, or products that the author uses or finds useful. These are not paid endorsements unless explicitly stated. The author's opinions are his own and are not influenced by advertisers.

Questions

For questions about anything on this site, please use the .

This site uses cookies for theme preferences and displays ads via Google AdSense, which may use cookies to personalise ads.