Parse the command line arguments that following the -- double dash. It assumes all arguments after the -- are formed as key=value paris. And it pass them to the next step as a record.
For example, if the command line arguments are tine some.toml -- --key1 value1 --key2 value2 then the record passed to the next step will be {key1="value1", key2="value2"}.
If value has prefix base64+ followed by http://, https://, or file://, then the value is base64 encoded string of the content that are fetched from the URL or file.
If value has prefix binary+ followed by http://, https://, or file://, then a BinaryField will be added instead of StringField within content that are fetched from the URL or file.
[[inlets.exec]]
## Commands array
commands = ["uname", "-m"]
## Environment variables
## Array of "key=value" pairs
## e.g. ["key1=value1", "key2=value2"]
environments = ["FOO=BAR"]
## Timeout
timeout = "3s"
## Ignore non-zero exit code
ignore_error = false
## Interval
interval = "10s"
## How many times to run the command, 0 for infinite
count = 0
## Trim space of output
trim_space = false
## Separator for splitting output
separator = ""
## Field name for stdout
stdout_field = "stdout"
## Field name for stderr
stderr_field = "stderr"
[[inlets.file]]
### input file path, "-" for stdin, if "data" is specified, this field is ignored
path = "/data/input.csv"
### input data in form of a string, if specified, "path" is ignored
data = [
"some,data,can,be,here",
"and,here",
]
### input format
format = "csv"
### name of the fields in the input data
fields = ["name", "time","value"]
### type of the fields in the input data, the number of fields and types should be equal.
### if fields and types are not specified, all fields are treated as strings.
types = ["string", "time", "int"]
### Is input data compressed
compress = ""
### time format (default: s)
### s, ms, us, ns, Golang timeformat string")
### e.g. timeformat = "2006-01-02 15:04:05 07:00"
timeformat = "s"
### timezone (default: Local)
### e.g. tz = "Local"
### e.g. tz = "UTC"
### e.g. tz = "America/New_York"
tz = "Local"
Example
[[inlets.file]]
data = [
"1,key1,1722642405,1.234",
"2,key2,1722642406,2.345",
]
format = "csv"
fields = ["line", "name", "time", "value"]
types = ["int", "string", "time", "float"]
[[outlets.file]]
format = "json"
[[inlets.screenshot]]
## The interval to run
interval = "3s"
## How many times run before stop (0 is infinite)
count = 1
## The display number to capture
## if it is empty, it will capture all displays
displays = [0, 1]
## capture image format
## available: rgba, png, jpeg, gif
format = "png"
[[inlets.sqlite]]
path = ":memory:?mode=memory&cache=shared"
inits = [
"CREATE TABLE IF NOT EXISTS load ( ts INTEGER PRIMARY KEY, load REAL)",
]
actions = [
[ "SELECT ts, load FROM load ORDER BY ts"],
]
Example
example_in.toml
[[inlets.sqlite]]
interval = "3s"
path = "./tmp/metrics.db"
actions = [
[
""" SELECT
time, name, value
FROM
metrics
ORDER BY
time
""",
],
]
[[outlets.file]]
path = "-"
format = "json"
decimal = 2
example_out.toml
[[inlets.cpu]]
interval = "3s"
percore = false
cputotal = true
[[flows.flatten]]
[[outlets.sqlite]]
path = "./tmp/metrics.db"
inits = [
"""
CREATE TABLE IF NOT EXISTS metrics (
time INTEGER,
name TEXT,
value REAL,
UNIQUE(time, name)
)
""",
]
actions = [
[
""" INSERT OR REPLACE INTO metrics (time, name, value)
VALUES (?, ?, ?)
""",
"_ts", "name", "value"
],
]