ConfD User Community

Display tailf:action output list as table


#1

How to print tailf:action list output as table?
As an example, “intro/7-c_actions” prints ping output as below.

admin@sde-sde-confd> request config host www.google.com ping count 4
header Invoked from cli: PING www.google.com (172.217.1.4) 56(84) bytes of data.
response {
    data 64 bytes from iad23s25-in-f4.1e100.net (172.217.1.4): icmp_seq=1 ttl=53 time=5.25 ms
}
response {
    data 64 bytes from iad23s25-in-f4.1e100.net (172.217.1.4): icmp_seq=2 ttl=53 time=7.47 ms
}
response {
    data 64 bytes from iad23s25-in-f4.1e100.net (172.217.1.4): icmp_seq=3 ttl=53 time=4.89 ms
}

Is there anyway we can display response output list as a table instead of braces?


#2

You can’t really change CLI output from an action directly, I’m afraid. But you can do one of the following:

  • declare (in your clispec file) and implement s.c. pipe command - it can be a script that reformats the output of your action; you can then use the action like request config ... | reformat

  • reimplement your action as a CLI command - you can reuse big part of the code, the advantage of a CLI command is that you can format it however you want; probably with some tricks in your clispec file you can even “override” the action so that the command is used when requested from CLI.

See man clispec for more details.