p4lf.cfg.example #1

  • //
  • p4lf/
  • dev/
  • p4lf.cfg.example
  • View
  • Commits
  • Open Download .zip Download (3 KB)
# p4lf.cfg — P4 Log Feeder configuration
#
# Copy to /p4/common/site/log_feeder/p4lf.cfg and edit as needed.
# The service reloads this file on SIGHUP or when it detects a modtime change.
# Lines beginning with '#' are comments. Blank lines are ignored.
# Format: KEY = VALUE  (spaces around '=' are optional)

# P4LogFile — Path to the Perforce server log file to tail.
# Default: $P4LOG environment variable (set by SDP p4_vars).
# Must be set here if $P4LOG is not available in the service environment.
#P4LogFile = /p4/1/logs/log

# LogTailDelay — How often to flush a log chunk.
# Format: <integer>[s|m|h]  e.g. 60s, 5m, 1h  (or plain integer = seconds)
# Default: 60s
LogTailDelay = 60s

# LogChunksDir — Directory where compressed chunk files are written.
# External automation should pick up files matching log.*.gz, ship them,
# and delete them.
# Default: $LOGS/logchunks
#LogChunksDir = /p4/1/logs/logchunks

# MaxLogChunks — Maximum number of log.*.gz files allowed in LogChunksDir
# before p4lf pauses and waits for files to be consumed.
# 0 = no limit.
# Default: 0
#MaxLogChunks = 0

# MinLogSpace — Minimum free space in the LogChunksDir volume before
# p4lf pauses.  Accepts a percentage (e.g. 3%) or a size (e.g. 500M, 3G).
# 'None' or '0' = no check.
# Default: None
#MinLogSpace = 3%
#MinLogSpace = 500M

# MaxLogSize — Maximum size of p4lf's own log ($LOGS/p4lf.log) before it is
# rotated.  The rotated log is gzipped.  0 = no rotation.
# Default: 100M
MaxLogSize = 100M

# MaxRotationRecoverySize — When a P4LOG rotation is detected, p4lf will
# read the new log from the beginning IF its current size is <= this value.
# If the new log is already larger (e.g. the service was down for a long time),
# p4lf starts from EOF and logs a warning to avoid ingesting a huge backlog.
# 0 = always read from beginning regardless of size.
# Default: 500M
MaxRotationRecoverySize = 500M

# StateFile — Path for the persistent state file (stores inode + byte offset).
# Used for checkpoint/resume across restarts.
# Default: $LOGS/p4lf.state
#StateFile = /p4/1/logs/p4lf.state

# ReadFromStart — On first run (no state file exists), whether to read the
# P4LOG from the beginning (true) or from the current end (false).
# true  = read from byte 0; all existing log data will be chunked on first run.
# false = start from EOF; only new data after service start will be captured.
# Default: true
ReadFromStart = true

# Debug — Verbosity level for p4lf's own log.
# 0 = off (INFO/WARN/ERROR only)
# 1 = debug messages enabled
# 2 = pedantic (very verbose)
# Default: 0
Debug = 0
# Change User Description Committed
#1 32818 C. Thomas Tyler Initial implementation of p4lf in Go.

Adds:
- Go module (github.com/rcowham/p4lf) with fsnotify dependency
- internal/config: KEY=VALUE config parser with all settings
- internal/tailer: file reader with inode-based rotation detection and
  state file checkpoint/resume (inode + byte offset, JSON, atomic write)
- internal/chunker: gzip chunk writer with MaxLogChunks/MinLogSpace guards
- internal/logger: rotating log writer with gzip of rotated files
- cmd/p4lf/main.go: service main loop, SIGHUP/SIGTERM/SIGINT handling,
  config hot-reload on modtime change
- Makefile: build/test/install/release targets for Linux amd64/arm64,
  macOS arm64/amd64; version injected via ldflags
- p4lf.cfg.example: fully documented example config
- p4lf.service: systemd unit file (User=perforce, Restart=on-failure)
- ai/session_log_2026-06-25.md: design session log
- ai/session_log_2026-06-25-2.md: implementation session log
- .p4ignore: added bin/ and dist/