A command-line tool to validate and test Honeycomb derived column expressions.
This tool helps validate derived column expressions used in Honeycomb by parsing them and checking for syntax errors. It can be used to test expressions before adding them to your Honeycomb datasets.
After installing the tool via:
go install github.com/honeycombio/honeycomb-derived-column-validator
You can run the validator with:
echo "expression" | honeycomb-derived-column-validator
or
honeycomb-derived-column-validator -f expression.txt
-f
Read from a file instead of stdin-v
Enable debug mode, which outputs all the detected syntax-help
Display a help message with usage instructions.
Run the command with a valid expression:
echo "IF(EQUALS(\$http.response.status_code, 200), 1)" | honeycomb-derived-column-validator -v
Output:
IF(EQUALS($http.response.status_code, 200), 1)
operator: IF
operator: EQUALS
column: http.response.status_code
literal: 200
literal: 1
and the command will exit with a status of 0
Run the command with a typoed expression (missing a closing paren):
echo "IF(1,2" | honeycomb-derived-column-validator -v
Output:
IF(1,2
operator: IF
Error parsing derived column: mismatched input '<EOF>' expecting {',', ')'}
exit status 1
The command automatically detects if has received JSON via stdin, intended for use with Terraform's external data source
The expected input should look like this:
{"expression": "IF(EQUALS(\$http.response.status_code, 200), 1)"}
And the expected output will be usable as data.external.resourcename.result.expression
See the Terraform examples for more.