XPath CBOR input data format

Use the xpath_cbor input data format to parse Concise Binary Object Representation (CBOR) data into Telegraf metrics using XPath 1.0 expressions.

xpath_cbor is one of the formats provided by the Telegraf XPath parser. It shares its configuration options and query syntax with the XPath JSON input data format. See that page for the complete option reference, the document-tree mapping, and query examples.

Configuration

[[inputs.file]]
  files = ["example.cbor"]
  data_format = "xpath_cbor"

  ## Keep native data types instead of converting everything to strings.
  ## Applies to batch-selected fields (field_selection).
  # xpath_native_types = false

  ## Print the internal document when debug logging is enabled.
  ## Especially useful for binary formats like CBOR.
  # xpath_print_document = false

  [[inputs.file.xpath]]
    # metric_selection = "/measurements/*"
    [inputs.file.xpath.fields]
      value = "number(value)"

Numeric keys

CBOR supports numeric keys, but the parser’s document tree requires node names to be strings starting with a letter. The parser prefixes numeric keys with a lowercase n and converts them to strings. For example, to query a CBOR key 123, use n123 in your XPath expressions.


Was this page helpful?

Thank you for your feedback!