<?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: Get specific values by providing key in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252897#M45191</link>
    <description>&lt;P&gt;You can use somesoni2's rex statement to pull out the fields but then depending on how you want to present the data you could do a simple stats command &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | dedup host | stats count by CPU OS | sort -count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Based on your query I'm guessing the data is generated every hour? Dedup is good though if the data is generated sporadically and you search over a longer period of time there can be more efficient ways to get the most recent data from each system. This also assumes you are saying "showing statistics on what &lt;EM&gt;combination&lt;/EM&gt; OS and CPU customers use mostly"&lt;/P&gt;

&lt;P&gt;A good resource to use for making regular expressions is &lt;A href="https://regex101.com/"&gt;regex101&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Sat, 19 Mar 2016 20:55:16 GMT</pubDate>
    <dc:creator>Runals</dc:creator>
    <dc:date>2016-03-19T20:55:16Z</dc:date>
    <item>
      <title>Get specific values by providing key</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252895#M45189</link>
      <description>&lt;P&gt;I have a lot of lines in the following format:&lt;/P&gt;

&lt;P&gt;CPU: 2.7GHz, 2, 'Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz', OS: 'Microsoft Windows 7 Professional x64 Edition Service Pack 1 (Build 7601)', SYS: 'HP EliteBook Folio 9480m', 'Hewlett-Packard'&lt;/P&gt;

&lt;P&gt;I get this list with: "CPU: earliest=-1h"&lt;/P&gt;

&lt;P&gt;I am trying to create a dashboard/graph showing statistics on what OS and CPU customers use mostly.&lt;/P&gt;

&lt;P&gt;How do I achieve this?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 21:45:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252895#M45189</guid>
      <dc:creator>thewho123</dc:creator>
      <dc:date>2016-03-18T21:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Get specific values by providing key</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252896#M45190</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo sourcetype=bar "CPU:" earliest=-1h | rex "CPU:\s+(?&amp;lt;CPU&amp;gt;.+),\s+OS:\s+(?&amp;lt;OS&amp;gt;.+),\s+SYS:(?&amp;lt;SYS&amp;gt;.+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Mar 2016 18:16:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252896#M45190</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-19T18:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get specific values by providing key</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252897#M45191</link>
      <description>&lt;P&gt;You can use somesoni2's rex statement to pull out the fields but then depending on how you want to present the data you could do a simple stats command &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | dedup host | stats count by CPU OS | sort -count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Based on your query I'm guessing the data is generated every hour? Dedup is good though if the data is generated sporadically and you search over a longer period of time there can be more efficient ways to get the most recent data from each system. This also assumes you are saying "showing statistics on what &lt;EM&gt;combination&lt;/EM&gt; OS and CPU customers use mostly"&lt;/P&gt;

&lt;P&gt;A good resource to use for making regular expressions is &lt;A href="https://regex101.com/"&gt;regex101&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2016 20:55:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252897#M45191</guid>
      <dc:creator>Runals</dc:creator>
      <dc:date>2016-03-19T20:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Get specific values by providing key</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252898#M45192</link>
      <description>&lt;P&gt;Thanks. One more question: What would I need to add to the rex string to get RAM if I have a log like this:&lt;/P&gt;

&lt;P&gt;CPU: 2.5GHz, 2, 'Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz', RAM(total): 7879MB, RAM(free): 3738MB, OS: 'Microsoft Windows 7 Professional x64 Edition Service Pack 1 (Build 7601)', SYS: '20AN0069US', 'LENOVO'&lt;/P&gt;

&lt;P&gt;I would be interested in RAM(total) and RAM(free)&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 21:25:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252898#M45192</guid>
      <dc:creator>thewho123</dc:creator>
      <dc:date>2016-03-23T21:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Get specific values by providing key</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252899#M45193</link>
      <description>&lt;P&gt;The regex is created in the same order they appear in the data, so for your sample logs, the rex command will be like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "CPU:\s+(?&amp;lt;CPU&amp;gt;.+),\s+RAM\(total\):\s+(?&amp;lt;RAM_total&amp;gt;.+),\s+RAM\(free\):\s+(?&amp;lt;RAM_free&amp;gt;.+),\s+OS:\s+(?&amp;lt;OS&amp;gt;.+),\s+SYS:(?&amp;lt;SYS&amp;gt;.+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Mar 2016 21:36:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-specific-values-by-providing-key/m-p/252899#M45193</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-03-23T21:36:55Z</dc:date>
    </item>
  </channel>
</rss>

