liveBook · Manning

Log segment

A log segment is a file-backed portion of a Kafka partition log containing a contiguous range of records and associated indexes.

How 2 Manning books explain it

Apache Kafka in Action

A log segment is a file containing a contiguous portion of the records in a Kafka partition log.

How it is used
Organizes a growing Kafka partition log into files that brokers append to and can later clean up.
How deep it goes
Explains segment files, offset-based names, inspection and rolling controls; defers the fuller treatment of cleanup.
Examples
Uses kafka-dump-log.sh output, a segment.ms configuration command and a partition-directory listing with successive .log files.
What you can do after
Operate/configure it by inspecting segment files, adjusting topic rolling limits and producing a message to trigger a roll check.

Read how Apache Kafka in Action explains log segment →

Kafka Streams in Action, Second Edition

A Kafka log segment is a file-backed portion of a partition's append-only log that contains a contiguous range of records along with its indexes.

How it is used
Uses segments to bound partition files, serve offset-based reads, and apply retention without scanning one monolithic log.
How deep it goes
Explains rolling triggers, directory files, relative offsets, binary search, and segment deletion, but not segment implementation code.
Examples
Uses purchases-0 directory listings, numbered segment files, and active-segment rollover to illustrate storage.
What you can do after
Evaluate/understand how Kafka locates records, rolls partition files, and removes segments under retention settings.

Read how Kafka Streams in Action, Second Edition explains log segment →

What to know first

Related concepts

Questions about log segment

What is log segment?

A log segment is a file-backed portion of a Kafka partition log containing a contiguous range of records and associated indexes.

Which Manning books explain log segment?

Apache Kafka in Action and Kafka Streams in Action, Second Edition.

What should I know before learning log segment?

Manning books that teach log segment usually introduce timestamp and message first.

What is the difference between log segment and log compaction?

A log segment is a file-backed portion of a Kafka partition log containing a contiguous range of records and associated indexes. Log compaction is a storage technique that retains the latest record for each key while removing superseded records.

What is log segment part of?

Log segment is part of partition. A division of a whole into distinct parts that together comprise the whole.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.