← 返回命令列表

Linux command

svlogd 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start logging to a directory

svlogd [/var/log/myservice]

Log with human-readable timestamps

svlogd -tt [/var/log/myservice]

Log with ISO 8601 timestamps

svlogd -ttt [/var/log/myservice]

Log to multiple directories

svlogd [/var/log/service1] [/var/log/service2]

Set buffer length

svlogd -b [8192] [/var/log/myservice]

Replace unprintable characters

svlogd -r [?] [/var/log/myservice]

说明

svlogd is the logging daemon for runit, a UNIX init scheme. It continuously reads log data from standard input, optionally filters and transforms log messages, and writes them to one or more automatically rotated log directories. Each log directory contains the current log file named current, and rotated logs with filenames starting with @ followed by a tai64n timestamp. Log rotation is configured via a config file in each log directory. The daemon supports filtering log messages using pattern matching, alerting selected messages to standard error or UDP destinations, and processing rotated logs with external programs. svlogd runs until it receives end-of-file on standard input or a TERM signal.

参数

-t
Prefix lines with tai64n timestamp.
-tt
Prefix lines with human-readable UTC timestamp (YYYY-MM-DD_HH:MM:SS.xxxxx).
-ttt
Prefix lines with ISO 8601 UTC timestamp (YYYY-MM-DDTHH:MM:SS.xxxxx).
-v
Verbose mode.
-r _c_
Replace unprintable characters with character c.
-R _xyz_
Character replacement specification.
-l _len_
Set maximum line length.
-b _buflen_
Set buffer length (default 1024).

FAQ

What is the svlogd command used for?

svlogd is the logging daemon for runit, a UNIX init scheme. It continuously reads log data from standard input, optionally filters and transforms log messages, and writes them to one or more automatically rotated log directories. Each log directory contains the current log file named current, and rotated logs with filenames starting with @ followed by a tai64n timestamp. Log rotation is configured via a config file in each log directory. The daemon supports filtering log messages using pattern matching, alerting selected messages to standard error or UDP destinations, and processing rotated logs with external programs. svlogd runs until it receives end-of-file on standard input or a TERM signal.

How do I run a basic svlogd example?

Run `svlogd [/var/log/myservice]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -t do in svlogd?

Prefix lines with tai64n timestamp.