Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/comcast/infinite-file-curtailer
Curtail is a utility program that reads stdin and writes to a file bound by size.
https://github.com/comcast/infinite-file-curtailer
command-line-tool log logging utility utility-library
Last synced: about 1 month ago
JSON representation
Curtail is a utility program that reads stdin and writes to a file bound by size.
- Host: GitHub
- URL: https://github.com/comcast/infinite-file-curtailer
- Owner: Comcast
- License: apache-2.0
- Created: 2018-11-02T18:16:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-12T16:04:58.000Z (about 1 year ago)
- Last Synced: 2024-04-13T09:05:23.432Z (9 months ago)
- Topics: command-line-tool, log, logging, utility, utility-library
- Language: C
- Homepage:
- Size: 30.3 KB
- Stars: 32
- Watchers: 9
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Infinite-File-Curtailer - a program that reads stdin and writes to a fixed size file.
Requires Linux 3.15+ and a filesystem that supports the FALLOC_FL_COLLAPSE_RANGE flag for fallocate. This is currently ext4 and XFS. Hopefully more in the future...
----
## Usage
```
./curtail [-s size]
```Options:
```
-verbose enable all debug output (on stderr)
-quiet disable all non-error output (on stderr)
-size Maximum size of the output file (ie. 8192, 64K, 10M, 1G, etc) - default is 16K
```## Example
A typical usage scenario is to capture the output of a program in a file. Using curtail prevents the program from creating a runaway file that will eventually fill up the filesystem and cause system failure if not handled at the system level. In the example below, the file my_app_log.txt cannot exceed 2 megabytes in size.
```
./my_app | curtail -s 2M ./my_app_log.txt
```## Build instructions
Curtail uses autotools (must be installed on the local system). If not already installed, install the tools using the following commands with the appropriate package manager (apt, yum, etc) for your system:
```
sudo apt install libtool
sudo apt install automake
sudo apt install autoconf
```To build curtail locally, please run the following commands from the base dir of the project:
```
libtoolize
aclocal
autoheader
autoconf
automake --add-missing
./configure
make
```To install in the local system, run the following additional command with appropriate priviledges:
```
sudo make install
```## Library usage
Curtail can also be integrated directly into an application instead of used on the command line. Include the file curtail.h and link the application with -lcurtail. After successfully calling crtl_init, the program's stdout will be directed to the specified file until crtl_term is called.
## Logrotate comparision
Curtail is not intended to be a replacement for logrotate. They are fundamentally different. Some of the notable differences are below:
logrotate mitigates runaway files... curtail prevents them.
logrotate requires sysadmin... curtail does not.
logrotate creates multiple files... curtail only one.