tee(1) with file rotation
- Go 100%
| cmd/rotatee | 0.2.2 | |
| .gitignore | .gitignore: ignore compiled executable | |
| go.mod | build: use vanity URL | |
| LICENSE | doc: add LICENSE | |
| README.md | build: use vanity URL | |
SYNOPSIS
rotatee [options] [file prefix]
DESCRIPTION
rotatee is tee(1) with file rotation:
- stdin is written to stdout
- stdin is also written to a file with a timestamp
- if the next line of input exceeds the maximum configured number of bytes, the input is written to a new file
- if SIGTERM is received,
rotateewill exit after writing the next line of input
BUILDING
go install go.iscode.ca/rotatee/cmd/rotatee@latest
Source
To build a reproducible executable from the git repository:
CGO_ENABLED=0 go build -trimpath -ldflags "-w" ./cmd/rotatee
EXAMPLES
# writes output to files in the current directory prefixed with "stdout"
rotatee
# writes output to files in /tmp prefixed with "output"
rotatee --dir=/tmp output
SIGNALS
- SIGHUP
- rotate log file
- SIGTERM
- write next line of input and exit (use
--ignoreto disable)
OPTIONS
- dir string
- output directory (default ".")
- format string
- timestamp format (default "2006年01月02日T15:04:05Z07:00.log")
- ignore
- ignore SIGTERM
- maxsize int
- max file size (MiB) (default 100)
- output-error string
- set behavior on write error (sigpipe, warn, warn-nopipe, exit, exit-nopipe) (default "sigpipe")
- warn: diagnose errors writing to any output
- warn-nopipe: diagnose errors writing to any output not a pipe
- exit: exit on error writing to any output
- exit-nopipe: exit on error writing to any output not a pipe
- sigpipe: exit on any error writing to a pipe, diagnose errors writing to any output not a pipe
- ignore: suppress and do not exit on errors