Hello,
I am trying to use xpath to retrieve certain fields from my xml file. The file looks something like this
<machines>
<machine name=a port=1 active="true">
<value>
<replace>Example<replace/>
<cfg>
<serverUrl>URL1</serverUrl>
<serverUsername>Username1</serverUsername>
</cfg>
</value>
</machine>
<machine>
<machine name=b port=2 active="true">
<value>
<replace>Example<replace/>
<cfg>
<serverUrl>URL2</serverUrl>
<serverUsername>Username2</serverUsername>
</cfg>
</value>
</machine>
</machines>
I want to pick out certain fields and link them together. For example, one report is to get the machine port and the serverUrl and show a table. E.g it would be
Node URL
1 URL1
2 URL2
The following commands get me the info I need. But if i put them together, the first breaks.
Command is as follows
index=DTS sourcetype=config | xpath "//machine/@port" outfield=port | xpath "//machine/value/with/cfg/serverUrl" outfield=name
Separately these work correctly and I see multiple values coming up. E.g port =1, port = 2 OR name=a, name=b
If I pipe, i get port = 12, name=a, name=b ie it joins the first result into a string.
Any ideas how i can get the table i am looking for?
Thanks
Hazel
... View more