# tanium/lumberjack architecture

> Architecture diagram of the GitHub repository tanium/lumberjack, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tanium/lumberjack
- Repository: https://github.com/tanium/lumberjack

## Overview

Lumberjack is a small Go rolling-file logger used as an io.Writer by logging applications. The principal workflow writes to the current log, rotates it when the configured size limit is reached, and manages timestamped backups through retention and optional gzip compression. The README documents these capabilities; the sampled implementation excerpts show the write-to-rotation path and post-rotation processing, but omit some internal details.

Main entry points: [`lumberjack.go`](https://github.com/tanium/lumberjack/blob/v2.0/lumberjack.go) (File rotation)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_application(("Logging application"))
node_logger["Logger writes<br/>[lumberjack.go]"]
node_rotation["File rotation<br/>[lumberjack.go]"]
node_retention["Backup retention<br/>[lumberjack.go]"]
node_compression["Gzip compression<br/>[lumberjack.go]"]
node_files[("Log files")]

node_application -->|"writes logs"| node_logger
node_logger -->|"rotates on size"| node_rotation
node_rotation -->|"renames and creates"| node_files
node_rotation -->|"cleans backups"| node_retention
node_rotation -->|"compresses backups"| node_compression
node_logger -->|"writes current file"| node_files

click node_logger "https://github.com/tanium/lumberjack/blob/v2.0/lumberjack.go"
click node_rotation "https://github.com/tanium/lumberjack/blob/v2.0/lumberjack.go"
click node_retention "https://github.com/tanium/lumberjack/blob/v2.0/lumberjack.go"
click node_compression "https://github.com/tanium/lumberjack/blob/v2.0/lumberjack.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_application toneIndigo
class node_logger,node_rotation,node_retention,node_compression toneTeal
class node_files toneAmber
```

## Components

### Other components

- **Logging application**
- [Logger writes](https://github.com/tanium/lumberjack/blob/v2.0/lumberjack.go): `lumberjack.go`
- [File rotation](https://github.com/tanium/lumberjack/blob/v2.0/lumberjack.go): `lumberjack.go`
- [Backup retention](https://github.com/tanium/lumberjack/blob/v2.0/lumberjack.go): `lumberjack.go`
- [Gzip compression](https://github.com/tanium/lumberjack/blob/v2.0/lumberjack.go): `lumberjack.go`
- **Log files**

## Connections

- Logging application → Logger writes: writes logs (evidence: `README.md`)
- Logger writes → File rotation: rotates on size (evidence: `README.md`)
- File rotation → Log files: renames and creates (evidence: `README.md`)
- File rotation → Backup retention: cleans backups (evidence: `lumberjack.go`)
- File rotation → Gzip compression: compresses backups (evidence: `lumberjack.go`)
- Logger writes → Log files: writes current file (evidence: `README.md`)
