<?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 regex/intelligent design question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/regex-intelligent-design-question/m-p/68222#M17075</link>
    <description>&lt;P&gt;I have a log entry that looks like this&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;2009-10-02 16:52:30 To USA-XXX F 2 &amp;amp;STR&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;where XXX is the account number - I have, as you may have guessed over 800 such account numbers (1 through 800 to be specific) trapped inside these logs that I need to do a timechart and group by on.&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I want to be able to extract the account number XXX from this search somehow. &lt;/P&gt;

&lt;P&gt;I have figured out the first step (unless regex is the way to go)&lt;/P&gt;

&lt;P&gt;i) filter all the matches using &lt;CODE&gt;sourcetype="usalog" | search *To*STR&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;ii) tag on another search that somehow filters the XXX &lt;/P&gt;

&lt;P&gt;Any suggestions ? Perhaps field extractions ? &lt;/P&gt;</description>
    <pubDate>Wed, 06 Jun 2012 03:02:46 GMT</pubDate>
    <dc:creator>asarolkar</dc:creator>
    <dc:date>2012-06-06T03:02:46Z</dc:date>
    <item>
      <title>regex/intelligent design question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-intelligent-design-question/m-p/68222#M17075</link>
      <description>&lt;P&gt;I have a log entry that looks like this&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;2009-10-02 16:52:30 To USA-XXX F 2 &amp;amp;STR&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;where XXX is the account number - I have, as you may have guessed over 800 such account numbers (1 through 800 to be specific) trapped inside these logs that I need to do a timechart and group by on.&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I want to be able to extract the account number XXX from this search somehow. &lt;/P&gt;

&lt;P&gt;I have figured out the first step (unless regex is the way to go)&lt;/P&gt;

&lt;P&gt;i) filter all the matches using &lt;CODE&gt;sourcetype="usalog" | search *To*STR&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;ii) tag on another search that somehow filters the XXX &lt;/P&gt;

&lt;P&gt;Any suggestions ? Perhaps field extractions ? &lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2012 03:02:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-intelligent-design-question/m-p/68222#M17075</guid>
      <dc:creator>asarolkar</dc:creator>
      <dc:date>2012-06-06T03:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: regex/intelligent design question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-intelligent-design-question/m-p/68223#M17076</link>
      <description>&lt;P&gt;Try something like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=usalog | rex field=_raw "To USA-(?&amp;lt;ac_number&amp;gt;\d{1,3})" | timechart count by ac_number
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can perform the Search time extraction on the account number inline using the rex command, as shown above , or save it(via Splunk Web or manual edit) in &lt;STRONG&gt;props.conf&lt;/STRONG&gt; using the EXTRACT keyword in a sourcetype stanza :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[usalog] 
EXTRACT-extract_ac_num = To USA-(?&amp;lt;ac_number&amp;gt;\d{1,3})
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Jun 2012 03:33:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-intelligent-design-question/m-p/68223#M17076</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2012-06-06T03:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: regex/intelligent design question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/regex-intelligent-design-question/m-p/68224#M17077</link>
      <description>&lt;P&gt;Thank you !&lt;/P&gt;

&lt;P&gt;That worked like a charm !&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2012 04:50:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/regex-intelligent-design-question/m-p/68224#M17077</guid>
      <dc:creator>asarolkar</dc:creator>
      <dc:date>2012-06-06T04:50:09Z</dc:date>
    </item>
  </channel>
</rss>

