• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

MakefileH A D04-Feb-2009406 2716

READMEH A D04-Feb-20092.2 KiB7051

flog.cH A D03-May-20225.9 KiB296220

README

1
2WHAT IS IT?
3===========
4
5flog (file logger) is a program that reads input from STDIN
6and writes to a file. if a SIGHUP is received, the file will be
7reopened, allowing for log rotation [see logrotate(8) on RH.]
8The log file will only be reopened if flog detects that
9rotation has occurred (ie, old file gone or inode changed).
10flog is very small (less than 500 bytes memory footprint.)
11
12
13USAGE
14=====
15
16Typically flog is used to log STDERR output from a daemon.
17It's also very useful with Apache. This way you never have
18to HUP apache itself:
19	ErrorLog	"|/bin/flog /httpd/logs/error_log"
20
21Typical example:
22	(mydaemon >stdout.file) |& flog [-t] stderr.file
23
24this will redirect daemon's STDOUT to a file called "stdout.file"
25and STDERR (thru flog) to "stderr.file". (example uses zsh: the
26best shell! like bash but better)
27
28The -t option causes a timestamp to be prepended to each line.
29
30The -T <format> option causes a timestamp to be prepended to each line
31with a user specified time format. See strftime(3) for how to specify
32the format.
33
34The -z option (pre-1.8 default behavior) causes the log file to be
35truncated to free up disk space in case the device gets full. In v1.8
36the default is now to buffer additional data in ram until there is
37disk space available again.
38
39
40FEATURES
41========
42
43if flog fills up a device (write returns ENOSPC), the log file
44will be truncated back to 0 and restarted. (this is an emergency
45avoidance feature only! always use logrotate to recycle logs)
46
47send as many HUPs as you want to flog, when a HUP is caught,
48the LOG will only be reopened if flog detects a logrotation.
49(ie, inode changed, or file disappeard)
50
51CHANGE LOG
52==========
53version 1.4 2005-01-17
54	Added large-file support (-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1) O_LARGEFILE
55version 1.5 2005-02-04
56	Re-arm signal handler (needed for solaris. thanks Claude)
57version 1.6 2005-06-02
58	Now compiles on OpenBSD
59version 1.7 2005-09-01
60	Added -l option to limit file length (patch by dsong@teramail.com)
61version 1.8 2009-02-04
62	Added -z option, but the default is now to buffer, not to truncate log if disk gets full.
63
64AUTHOR
65======
66
67Copyright (c) 2001-2009 Fredrik Sjoholm <fredrik@sjoholm.com>
68License: GPL - The GNU General Public License
69
70