add rotation
This commit is contained in:
@@ -181,7 +181,14 @@ def fetch_policies(args: argparse.Namespace) -> int:
|
||||
|
||||
|
||||
def listen_syslog(args: argparse.Namespace) -> int:
|
||||
listen_udp_syslog(args.host, args.port, args.output, quiet=args.quiet)
|
||||
listen_udp_syslog(
|
||||
args.host,
|
||||
args.port,
|
||||
args.output,
|
||||
rotate_bytes=args.rotate_bytes,
|
||||
rotate_count=args.rotate_count,
|
||||
quiet=args.quiet,
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
@@ -267,6 +274,8 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
listener.add_argument("--host", default="0.0.0.0", help="Bind address")
|
||||
listener.add_argument("--port", type=int, default=5514, help="UDP port. Use 514 only with sudo/capability.")
|
||||
listener.add_argument("--output", default="logs/fg_syslog.jsonl", help="File to append received logs to")
|
||||
listener.add_argument("--rotate-bytes", type=int, default=25 * 1024 * 1024, help="Rotate active log at this size; 0 disables rotation")
|
||||
listener.add_argument("--rotate-count", type=int, default=14, help="Number of compressed log archives to retain")
|
||||
listener.add_argument("--quiet", action="store_true", help="Do not print each received syslog message")
|
||||
listener.set_defaults(func=listen_syslog)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user