<?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: Creating a simple chart from extracting specific string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100143#M25889</link>
    <description>&lt;P&gt;Yes, that's exactly right. It's the count of events.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Oct 2013 10:09:11 GMT</pubDate>
    <dc:creator>philallen1</dc:creator>
    <dc:date>2013-10-16T10:09:11Z</dc:date>
    <item>
      <title>Creating a simple chart from extracting specific string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100136#M25882</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;This should be nice and easy for you lot.&lt;/P&gt;

&lt;P&gt;I have an application producing thousands of logs a day. In some of these logs there will be the phrase: "IncomeData SCV link" and some of the other logs there will be the phrase: "IncomeData started in". The two phrases will never be in the same log. &lt;BR /&gt;
They are also in different positions within the log, so I think field extractions is out of the question)&lt;/P&gt;

&lt;P&gt;I want to simply produce a column chart like below, that counts how many logs have the first phrase in and how many have the second phrase in.&lt;/P&gt;

&lt;P&gt;I use the below search to pull out all the logs, but I can't finish it off to produce the chart.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="UserLogs" Username=* "IncomeData SCV link" OR "IncomeData started in"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/chart_1.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2013 17:05:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100136#M25882</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2013-10-15T17:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a simple chart from extracting specific string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100137#M25883</link>
      <description>&lt;P&gt;By "how many logs" do you mean a count of events? so in your UserLogs sourcetype, say you had 1000 entries with "IncomeData SCV link" and 1500 entries with "IncomeData started in" you want the chart like you showed to reflet those numbers?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2013 17:34:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100137#M25883</guid>
      <dc:creator>jtrucks</dc:creator>
      <dc:date>2013-10-15T17:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a simple chart from extracting specific string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100138#M25884</link>
      <description>&lt;P&gt;The basic unit of performing statistics in splunk is called a field. In your case you need to make those phrases (or more precisely, the presence of those phrases in events) into fields before you can build charts/tables. Here is one way of doing it: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype="UserLogs" Username=* "IncomeData SCV link" OR "IncomeData started in" | rex "(?&amp;lt;phrase&amp;gt;IncomeData SCV link)" | rex "(?&amp;lt;phrase&amp;gt;IncomeData started in)" | stats count by phrase&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2013 17:35:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100138#M25884</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2013-10-15T17:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a simple chart from extracting specific string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100139#M25885</link>
      <description>&lt;P&gt;You can try this &lt;/P&gt;

&lt;P&gt;sourcetype="userlogs" UserName=* "IncomeData SCV link" | stats count as "IncomeData SCV link" | appendcols [search sourcetype="userlogs" UserName=* "IncomeData started in" | stats count as "IncomeData started in"]&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2013 17:47:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100139#M25885</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-10-15T17:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a simple chart from extracting specific string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100140#M25886</link>
      <description>&lt;P&gt;I would do it like this (with one rex):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="UserLogs" Username=* "IncomeData SCV link" OR "IncomeData started in" | rex field=_raw ".*\s(?&amp;lt;phrase&amp;gt;IncomeData (SCV link|started in))\s.*" | stats count by phrase
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is slightly more efficient and on large data volumes will be more efficient (faster).&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2013 17:47:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100140#M25886</guid>
      <dc:creator>jtrucks</dc:creator>
      <dc:date>2013-10-15T17:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a simple chart from extracting specific string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100141#M25887</link>
      <description>&lt;P&gt;Actually, the backtracking due to (two!) greedy quantifiers (.*) as well as the alternation (|) within the capture group make that a very inefficient regex. But, it does work.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2013 17:55:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100141#M25887</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2013-10-15T17:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a simple chart from extracting specific string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100142#M25888</link>
      <description>&lt;P&gt;This worked perfectly - thank you&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2013 10:08:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100142#M25888</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2013-10-16T10:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a simple chart from extracting specific string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100143#M25889</link>
      <description>&lt;P&gt;Yes, that's exactly right. It's the count of events.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2013 10:09:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-a-simple-chart-from-extracting-specific-string/m-p/100143#M25889</guid>
      <dc:creator>philallen1</dc:creator>
      <dc:date>2013-10-16T10:09:11Z</dc:date>
    </item>
  </channel>
</rss>

