---
title: "Kafka log start offset: why the earliest offset is not 0"
description: "Five records, then a retention.ms sweep deletes offsets 0-2. The Kafka log start offset moves to 3, which is where a consumer reading from earliest now begins."
url: https://monedula.dev/kafka-simulator/scenarios/log-start-offset/
---

# Kafka log start offset: why the earliest offset is not 0

Scenario 00.2.3 · Log start offset. Anatomy · Intermediate · about 2 min · Apache Kafka 4.3.

Offsets need not start at 0: retention deletes the oldest records, advancing the log start offset - the earliest readable record.

Run it: https://monedula.dev/kafka-simulator/playground/?scenario=00.2.3

## What you start with

Offsets don’t always begin at 0. Records are written in two batches, then a time-based retention sweep (retention.ms) deletes the older batch - advancing the log start offset so the earliest readable record is no longer offset 0.

## Step by step

1. **Empty log** (t+0.000s): A topic with retention.ms set. Records will be written in two batches. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=00.2.3&t=0)
2. **Offsets 0-4 · log start offset = 0** (t+1.400s): Five records occupy offsets 0-4. The log start offset is 0 - offset 0 is the earliest readable record. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=00.2.3&t=1)
3. **Old batch aged out · log start offset = 3** (t+2.100s): The retention sweep deleted the older batch (offsets 0-2) once it aged past retention.ms. Real Kafka deletes whole log segments, so this assumes offsets 0-2 sit in their own closed segment. The log start offset advanced to 3 - now the earliest readable record. Offsets 0-2 are gone forever; a consumer reading from 'earliest' begins at 3. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=00.2.3&t=2)

## The takeaway

The log start offset marks the oldest record still retained; retention deletes aged segments from the head of the log (whole segments, not single records), so consumers must tolerate an earliest offset greater than 0.

## Configs in this scenario

- [`retention.ms`](https://kafka.apache.org/43/configuration/topic-configs/#topicconfigs_retention.ms): How long a topic with cleanup.policy=delete keeps a log segment before it may be deleted (default 604800000, 7 days); -1 removes the time limit. [How retention.ms works](https://monedula.dev/kafka-simulator/configs/retention-ms/)

## Further reading

- [Apache Kafka documentation](https://kafka.apache.org/43/configuration/topic-configs/)
