Create/convert tag from telemetry xml data

I am trying to build a query from the data below, but I am unable to access the client-mac value as a tag and filter off of it.

I am able to “convert” the client-mac to a tag, but still don’t get any values when trying to access it. I am pretty new to Telegraf and just not sure how to address this.

Thanks


  <client-oper-data xmlns=http://cisco.com/ns/yang/Cisco-IOS-XE-wireless-client-oper>
    <mm-if-client-history>
      <client-mac>AA:BB:CC:DD:11:22</client-mac>
      <mobility-history>
        <entry>
          <instance-id>0</instance-id>
          <ms-ap-slot-id>1</ms-ap-slot-id>
          <ms-assoc-time>2024-06-13T17:37:09+00:00</ms-assoc-time>
          <role>mm-client-role-local</role>
          <bssid>ZZ:YY:XX:99:88:77</bssid>
          <ap-name>AP-NAME</ap-name>
          <run-latency>3033</run-latency>
          <dot11-roam-type>dot11-roam-type-slow-11i</dot11-roam-type>
        </entry>
      </mobility-history>
    </mm-if-client-history>
  </client-oper-data>

@choquettejm I would use

[[inputs.file]]
  files = ["test_configs/xmltest_forum_choquettejm.xml"]

  fieldexclude = ["ms-assoc-time", "run-latency"]
  data_format = "xml"
  xpath_native_types = true

  [[inputs.file.xpath]]
    metric_name = "'device'"
    metric_selection = "//entry"
    field_selection = "*"
    timestamp = "ms-assoc-time"
    timestamp_format = "rfc3339"

  [inputs.file.xpath.tags]
    mac = "//client-mac"

  [inputs.file.xpath.fields]
    latency = "number(run-latency)"

resulting in

> device,host=Hugin,mac=AA:BB:CC:DD:11:22 ap-name="AP-NAME",bssid="ZZ:YY:XX:99:88:77",dot11-roam-type="dot11-roam-type-slow-11i",instance-id="0",latency=3033,ms-ap-slot-id="1",role="mm-client-role-local",run-latency="3033" 1718300229000000000

for your example. Of course you need to replace inputs.file with whatever you need throughout the config.