v0.24.0 cli long and short options, http sink viewer and new logo
This commit is contained in:
1 parent
bf410e1225
commit
9e86d7999d
42 files changed
+786
-404
No files matched your search
+46
-34
@@ -13,55 +13,66 @@ const helpText = `LogWisp %s - log collection, processing, and distribution
|
||||
Usage:
|
||||
lw [options] [< input] No file, no pipeline options: stdin to stdout,
|
||||
line for line, like cat; exits at end of input
|
||||
lw -c <file> [options] Run the file's pipelines
|
||||
lw --check [options] Build every pipeline and plugin, report, exit
|
||||
lw -c|--config FILE [options] Run the file's pipelines
|
||||
lw -p|--preset SPEC [options] Run a preset's pipeline
|
||||
lw -t|--check [options] Build every pipeline and plugin, report, exit
|
||||
lw --dump [options] Print the effective configuration as TOML, exit
|
||||
lw help | -h | --help
|
||||
lw --version
|
||||
lw -V | --version
|
||||
|
||||
Commands (lw <command> -h lists its subcommands):
|
||||
Commands (lw COMMAND -h lists its subcommands):
|
||||
%s
|
||||
Scalar configuration keys are settable as flags using their TOML paths:
|
||||
--<path>=<value> e.g. --logging.level=debug
|
||||
|
||||
Common options:
|
||||
-c, --config <path> Configuration file (default: ./logwisp.toml)
|
||||
--quiet Suppress console output
|
||||
--color [<when>] Level names in color on console sinks:
|
||||
Options: a short option is its long one; a value follows as the next argument
|
||||
or after '=' (-c FILE, --config=FILE), one that starts with '-' after '=';
|
||||
short options do not combine.
|
||||
-c, --config FILE Configuration file (default:
|
||||
~/.config/logwisp/logwisp.toml if it exists,
|
||||
else ./logwisp.toml)
|
||||
-t, --check Build every pipeline and plugin, report, exit
|
||||
--dump Print the effective configuration, exit
|
||||
-q, --quiet Silence lw's own log and notices; pipeline
|
||||
output still flows
|
||||
--color [WHEN] Level names in color on console sinks:
|
||||
auto (a terminal, NO_COLOR unset; default),
|
||||
always (bare --color) or never
|
||||
--status_reporter=<bool> Periodic status logging (default: true with
|
||||
a configuration file)
|
||||
--auto_reload=<bool> Config hot reload on file change (default: false)
|
||||
-V, --version Print the version and exit
|
||||
-h, --help Print this help and exit
|
||||
-- End the options
|
||||
|
||||
Logging (lw's own log goes to stderr, at info with a configuration file and
|
||||
at warn without one):
|
||||
--logging.output=<mode> file|stdout|stderr|split|all|none
|
||||
--logging.level=<level> debug|info|warn|error
|
||||
--logging.file.directory=<path>
|
||||
Configuration keys are flags by their TOML path, '_' and '.' kept:
|
||||
--KEY=VALUE e.g. --logging.level=debug
|
||||
--status_reporter=BOOL Periodic status logging (default: true with
|
||||
a configuration file)
|
||||
--auto_reload=BOOL Reload when the file changes (default: false)
|
||||
Logging (lw's own log goes to stderr, at info with a configuration file and
|
||||
at warn without one):
|
||||
--logging.output=MODE file|stdout|stderr|split|all|none
|
||||
--logging.level=LEVEL debug|info|warn|error
|
||||
--logging.file.directory=DIR
|
||||
|
||||
Pipelines (replace the file's pipelines; see doc/cli.md):
|
||||
--preset <name>[,k=v...] Start a pipeline with a preset: pipe, tail,
|
||||
serve, edge, aggregator; lw preset <name> -h
|
||||
lists its keys, lw preset <name> prints it
|
||||
--pipeline <name> Start a pipeline; earlier specs go to "cli"
|
||||
--source <spec> TYPE[,key=value...], repeatable
|
||||
--sink <spec> e.g. http,host=0.0.0.0,port=8080, repeatable
|
||||
--filter <spec> include|exclude,patterns=RE, repeatable
|
||||
--format <spec> json|txt|raw[,key=value...]
|
||||
--rate-limit <spec> rate=N[,burst=N,policy=drop|pass]
|
||||
--heartbeat <spec> interval_ms=N[,include_stats=true,...]
|
||||
-p, --preset NAME[,KEY=VALUE...]
|
||||
Start a pipeline with a preset: pipe, tail,
|
||||
serve, edge, aggregator; lw preset NAME -h
|
||||
lists its keys, lw preset NAME prints it
|
||||
--pipeline NAME Start a pipeline; earlier specs go to "cli"
|
||||
--source SPEC TYPE[,KEY=VALUE...], repeatable
|
||||
--sink SPEC e.g. http,host=0.0.0.0,port=8080, repeatable
|
||||
--filter SPEC include|exclude,patterns=RE, repeatable
|
||||
--format SPEC json|txt|raw[,KEY=VALUE...]
|
||||
--rate-limit SPEC rate=N[,burst=N,policy=drop|pass]
|
||||
--heartbeat SPEC interval_ms=N[,include_stats=true,...]
|
||||
A pipeline without --source reads stdin, one without --sink writes stdout.
|
||||
Keys nest with '.' (tls.cert_file=...), a repeated key makes a list, and
|
||||
'\' escapes ',' '=' '\' in values. -- ends option parsing.
|
||||
'\' escapes ',' '=' '\' in values.
|
||||
|
||||
Examples:
|
||||
lw < app.log > copy.log Copy, line for line
|
||||
tail -F app.log | lw --filter include,patterns=ERROR,patterns=WARN
|
||||
journalctl -f | lw --sink http,host=127.0.0.1,port=8080
|
||||
Serve stdin as a live stream
|
||||
Serve stdin live; browse http://127.0.0.1:8080/
|
||||
lw --source file,directory=/var/log/app,pattern='*.log' --format txt
|
||||
lw --preset tail,path=/var/log/app Follow a directory's files
|
||||
lw -p tail,path=/var/log/app Follow a directory's files
|
||||
lw --preset serve,path=/var/log/app,tls=self,users=users.toml
|
||||
HTTPS stream, SCRAM logins
|
||||
lw --preset edge,path=/var/log/app,to=agg:9000,ca=ca.crt,user=edge-01,\
|
||||
@@ -83,14 +94,15 @@ Signals:
|
||||
|
||||
Exit codes:
|
||||
0 success, including the end of input
|
||||
1 general error
|
||||
1 general error, including an error in lw's own options (lw COMMAND
|
||||
exits 2 on a usage error)
|
||||
2 configuration file not found
|
||||
`
|
||||
|
||||
func printHelp() {
|
||||
var list strings.Builder
|
||||
for _, c := range commands {
|
||||
fmt.Fprintf(&list, " lw %-26s %s\n", c.name+" <command>", c.summary)
|
||||
fmt.Fprintf(&list, " lw %-26s %s\n", c.name+" COMMAND", c.summary)
|
||||
}
|
||||
fmt.Printf(helpText, version.Short(), list.String())
|
||||
}
|
||||
Reference in new issue
Block a user