Vector: Subcommand to list all available sources, transforms and sinks

Created on 25 Sep 2019  路  5Comments  路  Source: timberio/vector

It would be very nice to provide a cli subcommand that can list all the available sources, transforms and sinks. This would allow users to check what types of config options are available for that compiled version of the binary.

Example:

$ vector list
Sources:
- tcp
- udp
- syslog

Transforms:
- json_parser
- regex_parser

Sinks:
- aws_s3
- tcp
- http

We currently use typetag to add a static tag name to each of our structs. We could use a macro combined with this to generate a static string at compile time that can hold this information that is just printed out.

cli config good first issue feature

Most helpful comment

I think a subcommand probably suits this since we're also going to end up with generate further down the line.

I also think printing out plain text for now is fine since our key use case here is quickly answering "what can this thing do?" as a precurser to the generate command answering "and what does that look like?", so we could start with Lucios example:

$ vector list
Sources:
- tcp
- udp
- syslog

Transforms:
- json_parser
- regex_parser

Sinks:
- aws_s3
- tcp
- http

Possible Future Work

Then maybe later we could expand it to add a flag --format that supports different schemas:

$ vector list --format json
{"sources":["tcp","udp","syslog"],"transforms":["json_parser","regex_parser"],"sinks":["aws_s3","tcp","http"]}

And if it turns out we can do things like extract comments from the implementations themselves then it might be nice to add a --verbose flag as well:

$ vector list --format markdown --verbose
## Sources

###聽`tcp`

Does a thing

###聽`udp`

Does another thing.

##聽Transforms

###聽`json_parser`

You best bet on this one doing a thing!

All 5 comments

Expanding on this, an awesome stretch goal might be to enable generating configs for these types. Something like vector --generate source:udp,transform:json_parser,sink:tcp. This would likely require significant work but might also help with generating/updating our config examples.

Love the idea! Maybe even vector --generate udp|json_parser|tcp?

@loony-bean That's getting pretty close to the configuration language I've been dreaming about writing :smile:

Before we begin work I'd like to agree on the CLI interface. I'm not sure the one proposed in the original issue description is what we want to go with. @Jeffail do you want to provide some examples so we can get a consensus? Once we do that we can remove the needs: spec label.

I think a subcommand probably suits this since we're also going to end up with generate further down the line.

I also think printing out plain text for now is fine since our key use case here is quickly answering "what can this thing do?" as a precurser to the generate command answering "and what does that look like?", so we could start with Lucios example:

$ vector list
Sources:
- tcp
- udp
- syslog

Transforms:
- json_parser
- regex_parser

Sinks:
- aws_s3
- tcp
- http

Possible Future Work

Then maybe later we could expand it to add a flag --format that supports different schemas:

$ vector list --format json
{"sources":["tcp","udp","syslog"],"transforms":["json_parser","regex_parser"],"sinks":["aws_s3","tcp","http"]}

And if it turns out we can do things like extract comments from the implementations themselves then it might be nice to add a --verbose flag as well:

$ vector list --format markdown --verbose
## Sources

###聽`tcp`

Does a thing

###聽`udp`

Does another thing.

##聽Transforms

###聽`json_parser`

You best bet on this one doing a thing!
Was this page helpful?
0 / 5 - 0 ratings

Related issues

LucioFranco picture LucioFranco  路  3Comments

Hoverbear picture Hoverbear  路  3Comments

a-rodin picture a-rodin  路  3Comments

valyala picture valyala  路  3Comments

binarylogic picture binarylogic  路  3Comments