{
    "mode": "man",
    "parameter": "multilog",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/multilog/8/json",
    "generated": "2026-07-05T11:41:05Z",
    "synopsis": "multilog script",
    "sections": {
        "NAME": {
            "content": "multilog  -  reads a sequence of lines from stdin and appends selected lines to any number of\nlogs.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "multilog script\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "script consists of any number of arguments. Each argument specifies one action.  The  actions\nare  carried  out  in  order  for  each  line  of  input. Note that actions may contain shell\nmetacharacters that need to be quoted when multilog is run from a shell.\n\nmultilog exits 0 when it sees the end of stdin. If stdin has a partial final line then multi‐‐\nlog inserts a final newline.\n\nmultilog  writes a message to stderr and exits 111, without reading any input, if it runs out\nof memory or if another multilog process is writing to one of the same automatically  rotated\nlogs.\n\nIf multilog has trouble writing to disk after it starts reading input, it writes a message to\nstderr, pauses, and tries again, without losing any data. Note that this may block  any  pro‐\ngram feeding input to multilog.\n\nIf multilog receives a TERM signal, it will read and process data until the next newline, and\nthen exit, leaving stdin at the first byte of data it has not processed.\n",
            "subsections": []
        },
        "SELECTING LINES": {
            "content": "Each line is initially selected. The action\n\n-pattern\ndeselects the line if pattern matches the line. The action\n\n+pattern\nselects the line if pattern matches the line.\n\npattern is a string of stars and non-stars. It matches any concatenation of  strings  matched\nby  all  the  stars and non-stars in the same order. A non-star matches itself. A star before\nthe end of pattern matches any string that does not include the next character in pattern.  A\nstar at the end of pattern matches any string.\n\nFor example, the action\n\n+hello\n\nselects hello. It does not select hello world.\n\nThe action\n\n-named[*]: Cleaned cache *\n\ndeselects  named[135]: Cleaned cache of 3121 RRs. The first star matches any string that does\nnot include a right bracket.\n\nThe action\n\n-*\n\ndeselects every line.\n\nTo save memory, multilog actually checks pattern against only the first  1000  characters  of\neach line.\n",
            "subsections": []
        },
        "ALERTS": {
            "content": "The action\n\ne      prints (the first 200 bytes of) each selected line to stderr.\n",
            "subsections": []
        },
        "STATUS FILES": {
            "content": "The action\n\n=file  replaces  the  contents  of  file  with  (the first 1000 bytes of) each selected line,\npadded with newlines to 1001 bytes. There is no protection of file against power  out‐\nages.\n\nFor example, the sequence of actions\n\n-*\n+STAT*\n=log/status\n\nmaintains log/status as a copy of the most recent line starting with STAT.\n",
            "subsections": []
        },
        "TIMESTAMPING": {
            "content": "The action\n\nt      inserts  an  @, a precise timestamp, and a space in front of each line, using the same\nformat as tai64n(8).  This is required to be the first action.\n\nPatterns apply to the line after the timestamp is inserted. For example, if\n\nmultilog t '-*' '+* fatal: *' ./main\n\nreads the line\n\nfatal: out of memory\n\nthen it will log a line such as\n\n@400000003b4a39c23294b13c fatal: out of memory\n\nwith the first * matching the timestamp.\n\nYou can use tai64nlocal(8) to convert these timestamps to human-readable form.\n",
            "subsections": []
        },
        "AUTOMATICALLY ROTATED LOGS": {
            "content": "If dir starts with a dot or slash then the action\n\ndir    appends each selected line to a log named dir.  If dir does not exist,  multilog  cre‐\nates it.\n\nDo  not  attempt  to write to one log from two simultaneous multilog processes, or two\nactions in one process.\n\nThe log format is as follows.  dir is a directory containing some number  of  old  log\nfiles, a log file named current, and other files for multilog to keep track of its ac‐\ntions. Each old log file has a name beginning with @, continuing with a precise  time‐\nstamp showing when the file was finished, and ending with one of the following codes:\n\n.s     This file is completely processed and safely written to disk.\n\n.u     This file was being created at the moment of an outage. It may have been truncated and\nhas not been processed.\n\nBeware that NFS, async filesystems, and softupdates filesystems may discard files that\nwere not safely written to disk before an outage.\n\nWhile multilog is running, current has mode 644. If multilog sees the end of stdin, it\nwrites current safely to disk, and sets the mode of current to 744. When it  restarts,\nit sets the mode of current back to 644 and continues writing new lines.\n\nWhen  multilog  decides  that current is big enough, it writes current safely to disk,\nsets the mode of current to 744, and renames current as an old log file. The action\n\nssize  sets the maximum file size for subsequent dir actions.  multilog will decide that cur‐\nrent is big enough if current has size bytes.  (multilog will also decide that current\nis big enough if it sees a newline within 2000 bytes of  the  maximum  file  size;  it\ntries  to  finish  log  files  at  line  boundaries.)   size  must be between 4096 and\n16777215. The default maximum file size is 99999.\n\nIn versions 0.75 and above: If multilog receives an ALRM signal,  it  immediately  de‐\ncides that current is big enough, if current is nonempty.  The action\n\nnnum   sets  the  number  of log files for subsequent dir actions. After renaming current, if\nmultilog sees num or more old log files, it removes the old log file with the smallest\ntimestamp.  num must be at least 2. The default number of log files is 10. The action\n\n!processor\nsets  a processor for subsequent dir actions.  multilog will feed current through pro‐\ncessor and save the output as an old log file instead of current.  multilog will  also\nsave  any  output that processor writes to descriptor 5, and make that output readable\non descriptor 4 when it runs processor on the next log file. For reliability,  proces‐\nsor  must  exit  nonzero if it has any trouble creating its output; multilog will then\nrun it again. Note that running processor may block any program feeding input to  mul‐‐\ntilog.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "supervise(8),   svc(8),   svok(8),  svstat(8),  svscanboot(8),  svscan(8),  readproctitle(8),\nfghack(8), pgrphack(8), tai64n(8),  tai64nlocal(8),  setuidgid(8),  envuidgid(8),  envdir(8),\nsoftlimit(8), setlock(8)\n\nhttp://cr.yp.to/daemontools.html\n\n\n\nmultilog(8)",
            "subsections": []
        }
    },
    "summary": "multilog  -  reads a sequence of lines from stdin and appends selected lines to any number of logs.",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "supervise",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/supervise/8/json"
        },
        {
            "name": "svc",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svc/8/json"
        },
        {
            "name": "svok",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svok/8/json"
        },
        {
            "name": "svstat",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svstat/8/json"
        },
        {
            "name": "svscanboot",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svscanboot/8/json"
        },
        {
            "name": "svscan",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/svscan/8/json"
        },
        {
            "name": "readproctitle",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/readproctitle/8/json"
        },
        {
            "name": "fghack",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/fghack/8/json"
        },
        {
            "name": "pgrphack",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/pgrphack/8/json"
        },
        {
            "name": "tai64n",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/tai64n/8/json"
        },
        {
            "name": "tai64nlocal",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/tai64nlocal/8/json"
        },
        {
            "name": "setuidgid",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/setuidgid/8/json"
        },
        {
            "name": "envuidgid",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/envuidgid/8/json"
        },
        {
            "name": "envdir",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/envdir/8/json"
        },
        {
            "name": "softlimit",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/softlimit/8/json"
        },
        {
            "name": "setlock",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/setlock/8/json"
        }
    ]
}