XPath MessagePack input data format

Use the xpath_msgpack input data format to parse MessagePack data into Telegraf metrics using XPath 1.0 expressions.

xpath_msgpack 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.bin"]
  data_format = "xpath_msgpack"

  ## Keep native data types instead of converting everything to strings.
  ## MessagePack carries type information.
  # xpath_native_types = false

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

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

Because MessagePack is a binary format, use xpath_print_document = true with debug logging to inspect the parsed document and work out your queries. Fields containing byte arrays convert to strings by default. Use fields_bytes_as_hex or fields_bytes_as_base64 to encode them instead.


Was this page helpful?

Thank you for your feedback!