<?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 Re: How can I use Rex or Regex to shorten up a timechart search by removing xmlkv function? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373748#M109901</link>
    <description>&lt;P&gt;Can you perhaps show what your data looks like and what exactly you are trying to accomplish with that | xmlkv | search somequery part? Maybe give an example of the output you want from this.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Feb 2018 16:31:20 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2018-02-12T16:31:20Z</dc:date>
    <item>
      <title>How can I use Rex or Regex to shorten up a timechart search by removing xmlkv function?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373747#M109900</link>
      <description>&lt;P&gt;I'm trying to shorten up a timechart search by removing the xmlkv function.    I've tried numerous times using rex and regex but have been unsuccessful.   &lt;/P&gt;

&lt;P&gt;Current working search string takes to long to execute is this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abc sourcetype=abc_123 | xmlkv | search somequery
| timechart count by somequery usenull=F useother=F
| rename Yes AS "somequery good" No AS "somequery bad"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In place of the &lt;CODE&gt;xmlkv | search somequery&lt;/CODE&gt;  I've tried  &lt;CODE&gt;regex_raw="NoALIQuery."&lt;/CODE&gt;   and other variations.  The search pulls results, but for the purpose of timechart  it shows them as only Null.  I need them to show the somequery field true values of Yes or No&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 16:12:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373747#M109900</guid>
      <dc:creator>diddyb</dc:creator>
      <dc:date>2018-02-12T16:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use Rex or Regex to shorten up a timechart search by removing xmlkv function?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373748#M109901</link>
      <description>&lt;P&gt;Can you perhaps show what your data looks like and what exactly you are trying to accomplish with that | xmlkv | search somequery part? Maybe give an example of the output you want from this.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 16:31:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373748#M109901</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-02-12T16:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use Rex or Regex to shorten up a timechart search by removing xmlkv function?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373749#M109902</link>
      <description>&lt;P&gt;each search result has dozens of lines of xml formatted data.   I'm only concerned with the data in one field (it will either be Yes or No).  XMLKV would parse all the data and allow a search, but it takes a long time based on the amount of data.  I want to look at the single field only for the purpose of this seaech / timechart&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 16:52:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373749#M109902</guid>
      <dc:creator>diddyb</dc:creator>
      <dc:date>2018-02-12T16:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use Rex or Regex to shorten up a timechart search by removing xmlkv function?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373750#M109903</link>
      <description>&lt;P&gt;Can you add a sample of the node that you need to extract?&lt;/P&gt;

&lt;P&gt;You can either use &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath"&gt;spath&lt;/A&gt; to traverse and extract only the node you are interested in or else use &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex"&gt;rex&lt;/A&gt; to extract based on start and end pattern.&lt;/P&gt;

&lt;P&gt;Please add some sample event or mock data for the community to assist.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 17:45:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373750#M109903</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-12T17:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use Rex or Regex to shorten up a timechart search by removing xmlkv function?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373751#M109904</link>
      <description>&lt;P&gt;Without seeing an example of the data you have and specifically the field you want to extract - you may find help with the below.&lt;/P&gt;

&lt;P&gt;If you want to extract the value of the "gender" element from the following example XML:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;person&amp;gt;
  &amp;lt;gender&amp;gt;female&amp;lt;/gender&amp;gt;
  &amp;lt;firstname&amp;gt;Anna&amp;lt;/firstname&amp;gt;
  &amp;lt;lastname&amp;gt;Smith&amp;lt;/lastname&amp;gt;
&amp;lt;/person&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You would replace the xmlkv command with the following rex command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "gender=\"(?&amp;lt;gender&amp;gt;.*?)\""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If instead you want to extract the value of the gender attributefrom the following example XML:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;person gender="female"&amp;gt;
  &amp;lt;firstname&amp;gt;Anna&amp;lt;/firstname&amp;gt;
  &amp;lt;lastname&amp;gt;Smith&amp;lt;/lastname&amp;gt;
&amp;lt;/person&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then in this case you would replace the xmlkv command with the following rex command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "\&amp;lt;gender\&amp;gt;(?&amp;lt;gender&amp;gt;.*?)\&amp;lt;\/gender\&amp;gt;"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Feb 2018 17:51:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373751#M109904</guid>
      <dc:creator>sashraf</dc:creator>
      <dc:date>2018-02-12T17:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use Rex or Regex to shorten up a timechart search by removing xmlkv function?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373752#M109905</link>
      <description>&lt;P&gt;Its like your first example -     &lt;/P&gt;

&lt;P&gt;now in using this example.  if the expected results for gender is male or female, how to I use that data to create a timechart?  If I use:  &lt;/P&gt;

&lt;P&gt;timechart count by gender &lt;/P&gt;

&lt;P&gt;The results all show as NULL.  I would like them to show male or female&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 21:03:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-use-Rex-or-Regex-to-shorten-up-a-timechart-search-by/m-p/373752#M109905</guid>
      <dc:creator>diddyb</dc:creator>
      <dc:date>2018-02-12T21:03:19Z</dc:date>
    </item>
  </channel>
</rss>

