p4lf.service #1

  • //
  • p4lf/
  • dev/
  • p4lf.service
  • View
  • Commits
  • Open Download .zip Download (963 B)
[Unit]
Description=P4 Log Feeder - feeds Perforce server log chunks to LogChunksDir
After=network.target
# If p4d is managed by systemd on this host, uncomment to add ordering:
# After=p4d_1.service

[Service]
Type=simple
User=perforce
Group=perforce

# SDP environment: P4LOG and LOGS are set per instance in /p4/<instance>/bin/p4_vars.
# Adjust the instance number and source the vars file to populate the environment.
# Example for instance 1:
EnvironmentFile=-/p4/common/bin/p4_vars
Environment=INSTANCE=1

ExecStart=/p4/common/site/log_feeder/p4lf -config /p4/common/site/log_feeder/p4lf.cfg

# On SIGHUP: reload config and rotate p4lf's own log.
ExecReload=/bin/kill -HUP $MAINPID

Restart=on-failure
RestartSec=10s

# Ensure clean shutdown: SIGTERM first, then SIGKILL after 30s.
TimeoutStopSec=30
KillMode=mixed
KillSignal=SIGTERM

# Limit resource usage.
LimitNOFILE=65536

StandardOutput=null
StandardError=journal

[Install]
WantedBy=multi-user.target
# 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/