{
    "content": [
        {
            "type": "text",
            "text": "# svlogd (man)\n\n## NAME\n\nsvlogd - runit's service logging daemon\n\n## SYNOPSIS\n\nsvlogd [-tttv] [-r c] [-R xyz] [-l len] [-b buflen] logs\n\n## DESCRIPTION\n\nlogs consists of one or more arguments, each specifying a directory.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PATTERN MATCHING**\n- **OPTIONS** (8 subsections)\n- **SIGNALS**\n- **SEE ALSO**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "svlogd",
        "section": "",
        "mode": "man",
        "summary": "svlogd - runit's service logging daemon",
        "synopsis": "svlogd [-tttv] [-r c] [-R xyz] [-l len] [-b buflen] logs",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "-t",
                "long": null,
                "arg": null,
                "description": "tai64n program) when writing to log or to standard error."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "the form YYYY-MM-DDHH:MM:SS.xxxxx when writing to log or to standard error."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "the form YYYY-MM-DDTHH:MM:SS.xxxxx when writing to log or to standard error."
            },
            {
                "flag": "-r",
                "long": null,
                "arg": null,
                "description": "sages with c. Characters are replaced before pattern matching is applied."
            },
            {
                "flag": "-R",
                "long": null,
                "arg": null,
                "description": "found in xyz with c (default ``'')."
            },
            {
                "flag": "-l",
                "long": null,
                "arg": null,
                "description": "only. Default is 1000."
            },
            {
                "flag": "-b",
                "long": null,
                "arg": null,
                "description": "buffer size. Set the size of the buffer svlogd uses when reading from standard input and writing to logs to buflen. Default is 1024. buflen must be greater than len. For svlogd instances that process a lot of data in short time, the buffer size should be increased to improve performance."
            },
            {
                "flag": "-v",
                "long": null,
                "arg": null,
                "description": ""
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "sv",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/sv/8/json"
            },
            {
                "name": "runsv",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/runsv/8/json"
            },
            {
                "name": "chpst",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/chpst/8/json"
            },
            {
                "name": "runit",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/runit/8/json"
            },
            {
                "name": "runit-init",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/runit-init/8/json"
            },
            {
                "name": "runsvdir",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/runsvdir/8/json"
            },
            {
                "name": "runsvchdir",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/runsvchdir/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 113,
                "subsections": []
            },
            {
                "name": "PATTERN MATCHING",
                "lines": 23,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-t",
                        "lines": 2,
                        "flag": "-t"
                    },
                    {
                        "name": "-tt",
                        "lines": 2
                    },
                    {
                        "name": "-ttt",
                        "lines": 2
                    },
                    {
                        "name": "-r",
                        "lines": 2,
                        "flag": "-r"
                    },
                    {
                        "name": "-R",
                        "lines": 2,
                        "flag": "-R"
                    },
                    {
                        "name": "-l",
                        "lines": 2,
                        "flag": "-l"
                    },
                    {
                        "name": "-b",
                        "lines": 5,
                        "flag": "-b"
                    },
                    {
                        "name": "-v",
                        "lines": 1,
                        "flag": "-v"
                    }
                ]
            },
            {
                "name": "SIGNALS",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "svlogd - runit's service logging daemon\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "svlogd [-tttv] [-r c] [-R xyz] [-l len] [-b buflen] logs\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "logs consists of one or more arguments, each specifying a directory.\n\nsvlogd  continuously reads log data from its standard input, optionally filters log messages,\nand writes the data to one or more automatically rotated logs.\n\nRecent log files can automatically be processed by an arbitrary processor program  when  they\nare  rotated,  and  svlogd  can be told to alert selected log messages to standard error, and\nthrough udp.\n\nsvlogd runs until it sees end-of-file on standard input or is sent a TERM signal, see below.\n\nLOG DIRECTORY\nA log directory log contains some number of old log files, and the current log file  current.\nOld  log files have a file name starting with @ followed by a precise timestamp (see the dae‐\nmontools' tai64n program), indicating when current was rotated and renamed to this file.\n\nA log directory additionally contains the lock file lock, maybe state and newstate,  and  op‐\ntionally the file config.  svlogd creates necessary files if they don't exist.\n\nIf  svlogd has trouble opening a log directory, it prints a warning, and ignores this log di‐\nrectory.  If svlogd is unable to open all log directories given at the command line, it exits\nwith an error.  This can happen on start-up or after receiving a HUP signal.\n\nLOG FILE ROTATION\nsvlogd  appends  selected log messages to the current log file.  If current has size bytes or\nmore (or there is a new-line within the last len of size bytes), or is older than a specified\namount of time, current is rotated:\n\nsvlogd  closes  current,  changes  permission  of  current to 0755, renames current to @time‐\nstamp.s, and starts with a new empty current.  If svlogd sees num or more old  log  files  in\nthe  log directory, it removes the oldest one.  Note that this doesn't decrease the number of\nlog files if there are already more than num log files, this must be done manually, e.g.  for\nkeeping 10 log files:\n\nls -1 \\@* |sort |sed -ne '10,$p' |xargs rm\n\nPROCESSOR\nIf svlogd is told to process recent log files, it saves current to @timestamp.u, feeds @time‐\nstamp.u through ``sh -c \"processor\"'' and writes the output to @timestamp.t.  If the  proces‐\nsor  finishes  successfully,  @timestamp.t  is  renamed  to @timestamp.s, and @timestamp.u is\ndeleted; otherwise @timestamp.t is deleted and the processor is started again.   svlogd  also\nsaves any output that the processor writes to file descriptor 5, and makes that output avail‐\nable on file descriptor 4 when running processor on the next log file rotation.\n\nA processor is run in the background.  If svlogd sees a previously  started  processor  still\nrunning  when  trying to start a new one for the same log, it blocks until the currently run‐\nning processor has finished successfully.  Only the HUP signal works in that situation.  Note\nthat this may block any program feeding its log data to svlogd.\n\n\nCONFIG\nOn startup, and after receiving a HUP signal, svlogd checks for each log directory log if the\nconfiguration file log/config exists, and if so, reads the file line by line and adjusts con‐\nfiguration for log as follows:\n\nIf the line is empty, or starts with a ``#'', it is ignored.  A line of the form\n\nssize  sets  the  maximum file size of current when svlogd should rotate the current log file\nto size bytes.  Default is 1000000.  If size is zero, svlogd doesn't rotate log files.\nYou should set size to at least (2 * len).\n\nnnum   sets  the  number of old log files svlogd should maintain to num.  If svlogd sees more\nthat num old log files in log after log file rotation, it deletes the oldest one.  De‐\nfault is 10.  If num is zero, svlogd doesn't remove old log files.\n\nNmin   sets  the  minimum number of old log files svlogd should maintain to min.  min must be\nless than num.  If min is set, and svlogd cannot write to current because the filesys‐\ntem is full, and it sees more than min old log files, it deletes the oldest one.\n\nttimeout\nsets the maximum age of the current log file when svlogd should rotate the current log\nfile to timeout seconds.  If current is timeout seconds old, and is not empty,  svlogd\nforces log file rotation.\n\n!processor\ntells  svlogd  to  feed each recent log file through processor (see above) on log file\nrotation.  By default log files are not processed.\n\nua.b.c.d[:port]\ntells svlogd to transmit the first len characters of selected log messages to  the  IP\naddress  a.b.c.d, port number port.  If port isn't set, the default port for syslog is\nused (514).  len can be set through the -l option, see below.  If svlogd  has  trouble\nsending  udp  packets, it writes error messages to the log directory.  Attention: log‐\nging through udp is unreliable, and should be used in private networks only.\n\nUa.b.c.d[:port]\nis the same as the u line above, but the log messages are no longer written to the log\ndirectory,  but  transmitted  through udp only.  Error messages from svlogd concerning\nsending udp packages still go to the log directory.\n\npprefix\ntells svlogd to prefix each line to be written to the log directory, to  standard  er‐\nror, or through UDP, with prefix.\n\nIf  a  line  starts with a -, +, e, or E, svlogd matches the first len characters of each log\nmessage against pattern and acts accordingly:\n\n-pattern\nthe log message is deselected.\n\n+pattern\nthe log message is selected.\n\nepattern\nthe log message is selected to be printed to standard error.\n\nEpattern\nthe log message is deselected to be printed to standard error.\n\nInitially each line is selected to be written to log/current.  Deselected  log  messages  are\ndiscarded  from  log.   Initially each line is deselected to be written to standard err.  Log\nmessages selected for standard error are written to standard error.\n",
                "subsections": []
            },
            "PATTERN MATCHING": {
                "content": "svlogd matches a log message against the string pattern as follows:\n\npattern is applied to the log message one character by one, starting with the first.  A char‐\nacter  not  a  star  (``*'')  and not a plus (``+'') matches itself.  A plus matches the next\ncharacter in pattern in the log message one or more times.  A star before the end of  pattern\nmatches any string in the log message that does not include the next character in pattern.  A\nstar at the end of pattern matches any string.\n\nTimestamps optionally added by svlogd are not considered part of the log message.\n\nAn svlogd pattern is not a regular expression.  For example consider a log message like this\n\n2005-12-1809:13:50.97618 tcpsvd: info: pid 1977 from 10.4.1.14\n\nThe following pattern doesn't match\n\n-*pid*\n\nbecause the first star matches up to the first p in tcpsvd, and then the match fails  because\ni is not s.  To match this log message, you can use a pattern like this instead\n\n-*: *: pid *\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-t",
                        "content": "tai64n program) when writing to log or to standard error.\n",
                        "flag": "-t"
                    },
                    {
                        "name": "-tt",
                        "content": "the form YYYY-MM-DDHH:MM:SS.xxxxx when writing to log or to standard error.\n"
                    },
                    {
                        "name": "-ttt",
                        "content": "the form YYYY-MM-DDTHH:MM:SS.xxxxx when writing to log or to standard error.\n"
                    },
                    {
                        "name": "-r",
                        "content": "sages with c.  Characters are replaced before pattern matching is applied.\n",
                        "flag": "-r"
                    },
                    {
                        "name": "-R",
                        "content": "found in xyz with c (default ``'').\n",
                        "flag": "-R"
                    },
                    {
                        "name": "-l",
                        "content": "only.  Default is 1000.\n",
                        "flag": "-l"
                    },
                    {
                        "name": "-b",
                        "content": "buffer  size.  Set the size of the buffer svlogd uses when reading from standard input\nand writing to logs to buflen.  Default is 1024.  buflen must  be  greater  than  len.\nFor  svlogd instances that process a lot of data in short time, the buffer size should\nbe increased to improve performance.\n",
                        "flag": "-b"
                    },
                    {
                        "name": "-v",
                        "content": "",
                        "flag": "-v"
                    }
                ]
            },
            "SIGNALS": {
                "content": "If svlogd is sent a HUP signal, it closes and reopens all logs, and updates their  configura‐\ntion  according  to  log/config.   If svlogd has trouble opening a log directory, it prints a\nwarning, and discards this log directory.  If svlogd is unable to open  all  log  directories\ngiven at the command line, it exits with an error.\n\nIf  svlogd is sent a TERM signal, or if it sees end-of-file on standard input, it stops read‐\ning standard input, processes the data in the buffer, waits for all processor subprocesses to\nfinish if any, and exits 0 as soon as possible.\n\nIf  svlogd  is sent an ALRM signal, it forces log file rotation for all logs with a non empty\ncurrent log file.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "sv(8), runsv(8), chpst(8), runit(8), runit-init(8), runsvdir(8), runsvchdir(8)\n\nhttp://smarden.org/runit/\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Gerrit Pape <pape@smarden.org>\n\n\n\nsvlogd(8)",
                "subsections": []
            }
        }
    }
}