<?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 data from its position in string? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57776#M14107</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have just installed Splunk as want to get some reports out of a Barracuda Spam firewall we have installed that sends all data to a syslog server. I have installed Splunk on the same machine as syslog so getting the file imported was easy.&lt;/P&gt;

&lt;P&gt;The problem I am having is with trying to extract fields from the data as I can't seem to 'teach' the system the correct regex.&lt;/P&gt;

&lt;P&gt;The following is an example line from syslog (anonomiyzed obviously):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Sep 24 15:34:59 192.168.0.1 inbound/pass1[26165]: 114-38-48-47.dynamic.hinet.net[114.38.48.47] 1285338898-663591fe0001-1ljPNx 1285338898 1285338899 RECV sender@domain.com receiver@domain.com 2 62 114.38.48.47
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The data can be totally different which is why Splunk seems to have a problem with it, but the data is always in the same order:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Timestamp:  Sep 24 15:34:59
Host:  192.168.0.1
Process:  inbound/pass1[26165]:
Sender:  114-38-48-47.dynamic.hinet.net[114.38.48.47]
MessageID:  1285338898-663591fe0001-1ljPNx
StartTime:  1285338898
EndTime:  1285338899
Service:  RECV
From:  sender@domain.com
To:  receiver@domain.com
ActionCode:  2
ReasonCode:  62
SenderIP:  114.38.48.47
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It was all going well until I got to the ActionCode!&lt;/P&gt;

&lt;P&gt;There is always whitespace between the 'parts' so am sure it is just a matter of getting the regex correct but am struggling.&lt;/P&gt;

&lt;P&gt;Would appreciate some help.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;

&lt;P&gt;Pete.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Sep 2010 21:46:12 GMT</pubDate>
    <dc:creator>pshankland</dc:creator>
    <dc:date>2010-09-24T21:46:12Z</dc:date>
    <item>
      <title>Regex data from its position in string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57776#M14107</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have just installed Splunk as want to get some reports out of a Barracuda Spam firewall we have installed that sends all data to a syslog server. I have installed Splunk on the same machine as syslog so getting the file imported was easy.&lt;/P&gt;

&lt;P&gt;The problem I am having is with trying to extract fields from the data as I can't seem to 'teach' the system the correct regex.&lt;/P&gt;

&lt;P&gt;The following is an example line from syslog (anonomiyzed obviously):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Sep 24 15:34:59 192.168.0.1 inbound/pass1[26165]: 114-38-48-47.dynamic.hinet.net[114.38.48.47] 1285338898-663591fe0001-1ljPNx 1285338898 1285338899 RECV sender@domain.com receiver@domain.com 2 62 114.38.48.47
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The data can be totally different which is why Splunk seems to have a problem with it, but the data is always in the same order:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Timestamp:  Sep 24 15:34:59
Host:  192.168.0.1
Process:  inbound/pass1[26165]:
Sender:  114-38-48-47.dynamic.hinet.net[114.38.48.47]
MessageID:  1285338898-663591fe0001-1ljPNx
StartTime:  1285338898
EndTime:  1285338899
Service:  RECV
From:  sender@domain.com
To:  receiver@domain.com
ActionCode:  2
ReasonCode:  62
SenderIP:  114.38.48.47
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It was all going well until I got to the ActionCode!&lt;/P&gt;

&lt;P&gt;There is always whitespace between the 'parts' so am sure it is just a matter of getting the regex correct but am struggling.&lt;/P&gt;

&lt;P&gt;Would appreciate some help.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;

&lt;P&gt;Pete.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2010 21:46:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57776#M14107</guid>
      <dc:creator>pshankland</dc:creator>
      <dc:date>2010-09-24T21:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regex data from its position in string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57777#M14108</link>
      <description>&lt;P&gt;Can you post the regex you tried?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2010 22:26:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57777#M14108</guid>
      <dc:creator>christopherutz</dc:creator>
      <dc:date>2010-09-24T22:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Regex data from its position in string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57778#M14109</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;\w+ \d+ \d{2}:\d{2}:\d{2} (?&amp;lt;host&amp;gt;[0-9.]+)\s+(?&amp;lt;process&amp;gt;\S+)\s+(?&amp;lt;sender&amp;gt;\S+)\s+(?&amp;lt;msgid&amp;gt;\S+)\s+(?&amp;lt;starttime&amp;gt;\d+)\s+(?&amp;lt;endtime&amp;gt;\d+)\s+(?&amp;lt;service&amp;gt;\S+)\s+(?&amp;lt;from&amp;gt;\S+)\s+(?&amp;lt;to&amp;gt;\S+)\s+(?&amp;lt;actioncode&amp;gt;\S+)\s+(?&amp;lt;reasoncode&amp;gt;\S+)\s+(?&amp;lt;senderip&amp;gt;[0-9.]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Sep 2010 00:43:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57778#M14109</guid>
      <dc:creator>twinspop</dc:creator>
      <dc:date>2010-09-25T00:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Regex data from its position in string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57779#M14110</link>
      <description>&lt;P&gt;Does it always log a single To address, or can you have multiple entries?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Sep 2010 00:59:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57779#M14110</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-09-25T00:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Regex data from its position in string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57780#M14111</link>
      <description>&lt;P&gt;Thanks for the replies.&lt;/P&gt;

&lt;P&gt;Just to explain what I am trying...&lt;/P&gt;

&lt;P&gt;I am in the Search window and then click next to one of the entries and select "Extract Fields". I have then highlighted the bit I want to extract and dragged it into the Example Values box. Finally, I have then gone through deleting the sample extractions that were wrong.&lt;/P&gt;

&lt;P&gt;A pattern never correctly generates as the figures are so small, this is why I thought RegEx would be the correct way to look at the issue.&lt;/P&gt;

&lt;P&gt;Twinspop - could you let me know where I should be using the regex as assumed it would have been when extracting but that just failed &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Sep 2010 23:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-data-from-its-position-in-string/m-p/57780#M14111</guid>
      <dc:creator>pshankland</dc:creator>
      <dc:date>2010-09-28T23:07:34Z</dc:date>
    </item>
  </channel>
</rss>

