Skip to content

arnobeck/piper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forked from https://github.com/gongled/piper

PiperPurposeInstallationGetting startedUsageLicense

Piper Go Report Card

piper is a tiny and ease-to-use utility for log rotation for 12-factor apps that write their logs to stdout.

Purpose

piper solves these problems of logging design:

  • It supports log rotation by USR1 POSIX signal, in contrast to similar tools.
  • It rotates logs for apps that do not support log rotation out-of-box.
  • It rotates logs for apps that cannot be stopped for some reasons.
  • It rotates logs for apps by given duration.
  • It rotates logs for apps by given size limit.

Installation

From prebuilt package for RHEL7/CentOS7

[sudo] yum install -y http://yum.gongled.me/7/release/x86_64/gongled-release-7.4-0.el7.noarch.rpm
[sudo] yum install piper

From the source code

Install dependencies using a Go package manager:

make deps

Build piper:

make all

Getting started

Run piper to write stdin to /var/log/program.log file:

your_command_here | piper /var/log/program.log

Any output to stdout will be suppressed.

Usage

Usage: piper {options} path

Options

  --size, -s size       Max file size
  --keep, -k number     Number of files to keep
  --age, -a interval    Interval of log rotation
  --timestamp, -t       Prepend timestamp to every entry
  --no-color, -nc       Disable colored output
  --version, -v         Show information about version
  --help, -h            Show this help message

Examples

  piper /var/log/program.log
  Read stdin and write entries to the logging file

  piper -t /var/log/program.log
  Prepend timestamp to every entry

  piper -s 5MB -k 10 /var/log/program.log
  Rotate logging file if it is reached 5M. Keep only 10 files

  piper -a 10m -k 5 /var/log/program.log
  Rotate logging file every 10 minute. Keep only 5 files

License

Released under the MIT license (see LICENSE)

Sponsored by FunBox

About

Utility for log rotation for 12-factor apps

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 96.0%
  • Makefile 4.0%