Stream log output from all current and future files in a directory, updating as new files are added.
- match directories on full path instead of strings.HasPrefix - strip ansi escape sequences from structured log output - reorganize project directories |
||
|---|---|---|
| build | ||
| cmd | ||
| internal | ||
| scripts | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| Makefile | ||
| README.md | ||
taildir
Tail log files to stdout. Similar to the unix tail command, but designed specifically to be run as an init container in Kubernetes pods and tail log files from other processes running in the pod to stdout for collection.
In addition to basic tailing functionality, taildir also:
- Automatically add new files.
taildirautomatically starts watching files created in a watched directory if it has the specified file extension. - Outputs raw or structured logs. In structured mode new log lines are output as part of larger json formatted line that includes the log file name. When running in structured mode log lines are split into 4k chucks before being sent to stdout. Additional context is added to the chunked logs that includes a line chunk id and part number (starting at 1).
cli options
❯ ./bin/taildir -h
Usage: ./bin/taildir [flags] <directory1[:structured|:raw]> [directory2[:structured|:raw]] ...
Flags:
-ext string
Only tail Files with the given extension. This applies to all directories being watched. Default: .log (default ".log")
Arguments:
directory Directory to watch with optional output type. Format: /path/to/dir[:structured|:raw]
Examples: /var/log /app/logs:structured /tmp/logs:raw