How to query to CSV without annotation headers?

Hello, i am trying to use the command line “influx query” command to append data to a CSV file and would like to hide the annotation headers. I can’t figure out how to hide the header annotation, is that possible with query?

my query looks something like this:

influx query 'from(bucket:“mybucket”) |> range(start:-1m, stop: now()) |> drop(columns: ["_start", “_stop”, “_measurement”, “host”]) |> pivot(rowKey: ["_time"], columnKey: ["_field"], valueColumn: “_value”) ’ --raw -o xxxxx.xx -t “securitytoken==” >> output.csv

thanks in advance!

A

Not necessarily a flux solution, but using grep you can easily filter out the offending lines:

influx query --raw 'from(bucket:"system") |> range(start:-1m)' | grep -Ev '^(\s+|#.*|,result.*)?$' >> output.csv

Where the grep filters out any empty line, line with just spaces, lines that start with ‘#’ and lines that start with ‘,result’.

that’s great, thanks for this … i’ll give it a go, should be good enough for what i need.
cheers!

1 Like