<?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: Extracting values for table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455962#M128894</link>
    <description>&lt;P&gt;Hey Nate,&lt;/P&gt;

&lt;P&gt;This simple extraction should do the trick. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...BASE SEARCH...
 | rex field=_raw "linesPerSec\:\s+?(?&amp;lt;linesPerSec&amp;gt;\S+)[\S\s]+rowCount\:\s+?(?&amp;lt;rowCount&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 03 Jul 2019 17:30:04 GMT</pubDate>
    <dc:creator>rbechtold</dc:creator>
    <dc:date>2019-07-03T17:30:04Z</dc:date>
    <item>
      <title>Extracting values for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455960#M128892</link>
      <description>&lt;P&gt;I have events in my logs that look like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
     linesPerSec:    1694.67    
     message:    Status:    
     rowCount:   35600000   
     severity:   info
}   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;when i make a search like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="apps"  app="my-api" message="*Status:*" | table  _time,  linesPerSec, rowCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is what my table ends up looking like&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="This is what my table ends up looking like"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7280iD71C1A6423A17C92/image-size/large?v=v2&amp;amp;px=999" role="button" title="This is what my table ends up looking like" alt="This is what my table ends up looking like" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;How do I get the number value away from the key for both linesPerSec and rowCount? I want to see all instances. I tried using values(linesPerSec) but that seemed to aggregate only unique.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Nate&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 15:29:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455960#M128892</guid>
      <dc:creator>reinharn</dc:creator>
      <dc:date>2019-07-03T15:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455961#M128893</link>
      <description>&lt;P&gt;You could use a regex to extract just the number.&lt;CODE&gt;|rex field=_raw "linesPerSec (?&amp;lt;linesPerSec&amp;gt;\d+$)"|rex field=_raw "rowCount (?&amp;lt;rowCount&amp;gt;\d+$)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;EDIT: Cant get it to show but between the ? and \d would be the value name you want to use in the search surrounded by &amp;lt;&amp;gt;. &lt;/P&gt;

&lt;P&gt;This would get you just the number values. If you are using the log a lot also you should look at setting up a field extraction; it would make it easier in the future.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 17:11:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455961#M128893</guid>
      <dc:creator>aohls</dc:creator>
      <dc:date>2019-07-03T17:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455962#M128894</link>
      <description>&lt;P&gt;Hey Nate,&lt;/P&gt;

&lt;P&gt;This simple extraction should do the trick. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...BASE SEARCH...
 | rex field=_raw "linesPerSec\:\s+?(?&amp;lt;linesPerSec&amp;gt;\S+)[\S\s]+rowCount\:\s+?(?&amp;lt;rowCount&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Jul 2019 17:30:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455962#M128894</guid>
      <dc:creator>rbechtold</dc:creator>
      <dc:date>2019-07-03T17:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455963#M128895</link>
      <description>&lt;P&gt;Thanks for the response!&lt;/P&gt;

&lt;P&gt;If I wanted to get those values into the table how would I go about that?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="apps"  app="my-api" message="*\Status:*" | table linesPerSec, rowCount | rex field=_raw "linesPerSec\:\s+?(?&amp;lt;linesPerSec&amp;gt;\S+)[\S\s]+rowCount\:\s+?(?&amp;lt;rowCount&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I still get the table values as the key/value. &lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 17:34:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455963#M128895</guid>
      <dc:creator>reinharn</dc:creator>
      <dc:date>2019-07-03T17:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455964#M128896</link>
      <description>&lt;P&gt;No problem!&lt;/P&gt;

&lt;P&gt;Since the fields don't exist until after the extraction is complete, you'll need to move the table to be after your extraction in order to see them.&lt;/P&gt;

&lt;P&gt;This should correct the issue:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="apps"  app="my-api" message="*\Status:*" | rex field=_raw "linesPerSec\:\s+?(?&amp;lt;linesPerSec&amp;gt;\S+)[\S\s]+rowCount\:\s+?(?&amp;lt;rowCount&amp;gt;\S+)" | table _time linesPerSec, rowCount 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if there are any problems!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 17:50:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455964#M128896</guid>
      <dc:creator>rbechtold</dc:creator>
      <dc:date>2019-07-03T17:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455965#M128897</link>
      <description>&lt;P&gt;Just tried that. Still doesn't seem to like to separate the values. &lt;IMG src="https://imgur.com/a/2v3OcMa" alt="Here is and image of what I am seeing." /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 18:15:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455965#M128897</guid>
      <dc:creator>reinharn</dc:creator>
      <dc:date>2019-07-03T18:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455966#M128898</link>
      <description>&lt;P&gt;&lt;A href="https://imgur.com/a/2v3OcMa"&gt;https://imgur.com/a/2v3OcMa&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 18:17:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455966#M128898</guid>
      <dc:creator>reinharn</dc:creator>
      <dc:date>2019-07-03T18:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455967#M128899</link>
      <description>&lt;P&gt;Let's try a different approach -- extracting directly from the fields themselves.&lt;/P&gt;

&lt;P&gt;Could you give this a try for me? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="apps"  app="my-api" message="*\Status:*" 
| rex field=linesPerSec "(?&amp;lt;LPS&amp;gt;[\d\.]+)"
| rex field=rowCount "(?&amp;lt;RC&amp;gt;\d+)"
| table _time LPS RC
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since I'm not exactly sure if the problem is coming from the fields or the extraction, I'm just going to bypass both and create two new fields: LPS (linesPerSec) and RC (rowCount). &lt;/P&gt;

&lt;P&gt;These &lt;EM&gt;should&lt;/EM&gt; contain the correct values.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 18:39:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455967#M128899</guid>
      <dc:creator>rbechtold</dc:creator>
      <dc:date>2019-07-03T18:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting values for table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455968#M128900</link>
      <description>&lt;P&gt;That worked! Thanks so much!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 18:41:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-values-for-table/m-p/455968#M128900</guid>
      <dc:creator>reinharn</dc:creator>
      <dc:date>2019-07-03T18:41:53Z</dc:date>
    </item>
  </channel>
</rss>

