[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 by sourcing
# /p4/common/bin/p4_vars <instance>. That file is a real shell script (uses
# command substitution, conditionals, etc.), NOT a simple KEY=VALUE file, so
# it cannot be loaded via systemd's EnvironmentFile= directive (systemd will
# silently ignore every non-trivial line, leaving P4LOG/LOGS unset). Instead,
# source it in a shell wrapper before exec'ing the binary.
# Adjust the instance number below as needed:
Environment=INSTANCE=1
ExecStart=/bin/bash -c 'source /p4/common/bin/p4_vars ${INSTANCE} && exec /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 | |
|---|---|---|---|---|---|
| #2 | 33273 | C. Thomas Tyler | Promote v1.0.4 from dev to main: p4lf.service p4_vars fix, README install docs + DeveloperGuide link, DeveloperGuide.md, SemVer 1.0.4. | ||
| #1 | 33231 | C. Thomas Tyler | Promoted to main for release. | ||
| //p4lf/dev/p4lf.service | |||||
| #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/ |
||