<?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: State with custom source in by clause in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/State-with-custom-source-in-by-clause/m-p/195766#M56437</link>
    <description>&lt;P&gt;This is a little clunky but it will work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventType=type1 | rex "source=(?&amp;lt;Source&amp;gt;\S+)"  | stats count as occurrences by Source, eventType
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Notice that your custom source is now named "Source". Since field names are case-sensitive, this avoids the conflict.&lt;BR /&gt;
You could put this regular expression into the appropriate &lt;CODE&gt;props.conf&lt;/CODE&gt; file and then your "Source" would always be accessible, without the need for the &lt;CODE&gt;rex&lt;/CODE&gt; command...&lt;/P&gt;</description>
    <pubDate>Thu, 20 Mar 2014 07:51:48 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2014-03-20T07:51:48Z</dc:date>
    <item>
      <title>State with custom source in by clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/State-with-custom-source-in-by-clause/m-p/195765#M56436</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am currently faced with the problem while creating stats for a specific event, where the event itself contains a custom source field. With my current search it will use the default source field rather than the custom source field of the event. How can I use this custom source field in the by clause of the stats command? &lt;/P&gt;

&lt;P&gt;Here an event sample:&lt;BR /&gt;
 &lt;CODE&gt;&lt;BR /&gt;
name=testEvent source=application1 eventType=type1&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Here the search:&lt;BR /&gt;
 &lt;CODE&gt;&lt;BR /&gt;
eventType=type1 | stats count as occurrences by source, eventType&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;BR /&gt;
Rainer&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 00:04:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/State-with-custom-source-in-by-clause/m-p/195765#M56436</guid>
      <dc:creator>rainerst</dc:creator>
      <dc:date>2014-03-20T00:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: State with custom source in by clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/State-with-custom-source-in-by-clause/m-p/195766#M56437</link>
      <description>&lt;P&gt;This is a little clunky but it will work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventType=type1 | rex "source=(?&amp;lt;Source&amp;gt;\S+)"  | stats count as occurrences by Source, eventType
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Notice that your custom source is now named "Source". Since field names are case-sensitive, this avoids the conflict.&lt;BR /&gt;
You could put this regular expression into the appropriate &lt;CODE&gt;props.conf&lt;/CODE&gt; file and then your "Source" would always be accessible, without the need for the &lt;CODE&gt;rex&lt;/CODE&gt; command...&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 07:51:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/State-with-custom-source-in-by-clause/m-p/195766#M56437</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-03-20T07:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: State with custom source in by clause</title>
      <link>https://community.splunk.com/t5/Splunk-Search/State-with-custom-source-in-by-clause/m-p/195767#M56438</link>
      <description>&lt;P&gt;thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Mar 2014 16:29:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/State-with-custom-source-in-by-clause/m-p/195767#M56438</guid>
      <dc:creator>rainerst</dc:creator>
      <dc:date>2014-03-20T16:29:26Z</dc:date>
    </item>
  </channel>
</rss>

