<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to append XML from subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-append-XML-from-subsearch/m-p/148531#M41530</link>
    <description>&lt;P&gt;I'm trying to append xmlkv results to my original search string. Here is what I've tried, and what is not working.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=content_eng source="dbmon-tail://kemgr-a1p/Jobs General" | eval JobID=id | eval XML_SRC=("/opt/elemental_se/web/log/*/job_"+JobID+"/*_emecmd.xml") | convert timeformat="%H%M%S" mktime(completed_at) mktime(started_at) | fieldformat completed_at=strftime(completed_at,"%H:%M:%S") | fieldformat started_at=strftime(started_at,"%H:%M:%S") | eval TimeDiff=completed_at-started_at | eval JobLength=strftime(TimeDiff, "%M:%S") | append [ search source=XML_SRC  "&amp;lt;command value='job'&amp;gt;" | xmlkv ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is the XML_SRC going to work in a subsearch like that? Any suggestions on how to achieve this? If anything, I'd like to obtain just one result of the xmlkv in the subsearch. It's named file_size. But there is a bunch more I'd like to eventually include, so I figured just bringing it all in as extra fields would be best.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:21:14 GMT</pubDate>
    <dc:creator>helius</dc:creator>
    <dc:date>2020-09-28T18:21:14Z</dc:date>
    <item>
      <title>How to append XML from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-append-XML-from-subsearch/m-p/148531#M41530</link>
      <description>&lt;P&gt;I'm trying to append xmlkv results to my original search string. Here is what I've tried, and what is not working.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=content_eng source="dbmon-tail://kemgr-a1p/Jobs General" | eval JobID=id | eval XML_SRC=("/opt/elemental_se/web/log/*/job_"+JobID+"/*_emecmd.xml") | convert timeformat="%H%M%S" mktime(completed_at) mktime(started_at) | fieldformat completed_at=strftime(completed_at,"%H:%M:%S") | fieldformat started_at=strftime(started_at,"%H:%M:%S") | eval TimeDiff=completed_at-started_at | eval JobLength=strftime(TimeDiff, "%M:%S") | append [ search source=XML_SRC  "&amp;lt;command value='job'&amp;gt;" | xmlkv ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is the XML_SRC going to work in a subsearch like that? Any suggestions on how to achieve this? If anything, I'd like to obtain just one result of the xmlkv in the subsearch. It's named file_size. But there is a bunch more I'd like to eventually include, so I figured just bringing it all in as extra fields would be best.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:21:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-append-XML-from-subsearch/m-p/148531#M41530</guid>
      <dc:creator>helius</dc:creator>
      <dc:date>2020-09-28T18:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to append XML from subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-append-XML-from-subsearch/m-p/148532#M41531</link>
      <description>&lt;P&gt;I was able to figure this out. Here is the final result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ search index=content_eng source="dbmon-tail://kemgr-a1p/Jobs General" | eval source=("/opt/elemental_se/web/log/*/job_"+id+"/*_emecmd.xml") | table source ] | rex field=source "job_(?&amp;lt;JobID&amp;gt;\d+)" | search "&amp;lt;command value='job'&amp;gt;" | xmlkv | stats count by JobID, file_size | appendcols [ search index=content_eng source="dbmon-tail://kemgr-a1p/Jobs General" | convert timeformat="%H%M%S" mktime(completed_at) mktime(started_at)  | fieldformat completed_at=strftime(completed_at,"%H:%M:%S")  | fieldformat started_at=strftime(started_at,"%H:%M:%S") | eval TimeDiff=completed_at-started_at  | eval JobLength=strftime(TimeDiff, "%M:%S") ] | table id started_at completed_at JobLength file_size
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/cONxloG.jpg" alt="alt text" title="Title" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Dec 2014 22:48:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-append-XML-from-subsearch/m-p/148532#M41531</guid>
      <dc:creator>helius</dc:creator>
      <dc:date>2014-12-18T22:48:17Z</dc:date>
    </item>
  </channel>
</rss>

