Skip to content

OutputLog mirrors command output to both stdout and timestamped log files

License

Notifications You must be signed in to change notification settings

automation64/outputlog

Repository files navigation

OutputLog

License GitHub stars GitHub forks Release Downloads

🚀 OutputLog mirrors command output to both stdout and timestamped log files



📌 Overview

🚀 OutputLog mirrors command output to both stdout and timestamped log files

Use for quickly recording troubleshooting activities, and system administration tasks:

  • (📤) Mirror standard output in real-time using shell pipes
  • (📁) Automatically create and manage log directories
  • (⏰) Automatically add timezone-aware timestamps to log filenames
  • (⏱️) Set timeout thresholds for long-running commands
  • (🔍) Enable verbose mode to track capture start/end times and file locations

🚀 Usage

  <COMMAND> | ol [flags]

Flags

-e, --extension:  string log filename extension (override with shell-env OUTPUTLOG_EXTENSION) (default ".txt")
-h, --help:       help for ol
-d, --path:       string destination directory (override with shell-env OUTPUTLOG_PATH) (default "$HOME/outputlog")
-p, --prefix:     string log filename prefix (override with shell-env OUTPUTLOG_PREFIX) (default "command-output")
-t, --timeout:    duration duration to wait for input before exiting (e.g. 30s, 1m) (override with shell-env OUTPUTLOG_TIMEOUT) (default 1m0s)
-v, --verbose:    enable verbose logging to stderr (override with shell-env OUTPUTLOG_VERBOSE)
--version:        version for ol

Examples

  • Quick capture with default settings:
my-deployment-script | ol
# Logs to: ~/outputlog/command-output-<timestamp>.txt
  • Custom log location and filename pattern:
kubectl get pods -A | ol --path ./kube-logs --prefix pods --extension .txt
# Logs to: ./kube-logs/pods-<timestamp>.txt
  • Configure via environment variables:
export OUTPUTLOG_PATH=/var/log/jobs
export OUTPUTLOG_PREFIX=backup
export OUTPUTLOG_TIMEOUT=5m
backup-script | ol --verbose
# Logs to: /var/log/jobs/backup-<timestamp>.txt with verbose output

🛠 Contributing

Contributions are welcome! Help us improve by submitting issues, feature requests, or pull requests.


⚠️ Disclaimer

This repository is provided "as is" without any warranties. The author is not responsible for any damages or issues arising from its use. Additionally, this project is not affiliated with or endorsed by any organization or entity. Use at your own risk.


📜 License

OutputLog is licensed under the Apache-2.0 License.


👤 Author


🌟 If you find this project useful, consider giving it a star!

About

OutputLog mirrors command output to both stdout and timestamped log files

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors