<?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 help with Search time field extractions from syslog source in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26907#M5218</link>
    <description>&lt;P&gt;I have a string of text from a syslog feed source:&lt;/P&gt;

&lt;P&gt;Nov  8 16:16:51 192.168.2.10 Nov  8 16:16:19 SuperServer PES0: Site: Sitename,Server: &lt;/P&gt;

&lt;P&gt;Srvr1,Domain: Default,Admin: user1,Policy has been fixed,Policyname - X&lt;/P&gt;

&lt;P&gt;I am trying to extract the last three fields from this data, and I can't seem to get it to work.  I'm only trying it out in Search first, but am thinking of using an EXTRACT in props.conf finally.  The rest of the regex I have doublechecked, using a Perl Regex editor and RegExr, too.  All of the syntax seems to be correct, until I try to extract the fields.  Here's the regex with search command I have so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    Source=syslog | rex ".*,Admin:\s(?&amp;lt;user&amp;gt;\w+),(?&amp;lt;message&amp;gt;.*),(?&amp;lt;policy&amp;gt;.*)" | table user message policy
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But my field extraction attempts here yield nothing so far.  Any suggestions?  &lt;/P&gt;

&lt;P&gt;My follow on issue is that I get additional logs from this same source:&lt;/P&gt;

&lt;P&gt;Nov  8 16:16:51 192.168.2.10 Nov  8 16:16:19 SuperServer PES0: MACHINE_NAME,Continue,,File Read,Begin: 2012-10-03 01:54:38,End: 2012-10-03 01:54:38,Rule: Log write - media,3196,C:/Windows/System32/svchost.exe,0,No Module Name,C:/Temp/filename.txt,User: SYSTEM,Domain: STANDALONE,Action Type:&lt;/P&gt;

&lt;P&gt;Here is the regex I have so far to extract fields from it, too:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Source=syslog | rex ".*PES0:\s(?&amp;lt;machine&amp;gt;\w+),(?&amp;lt;srvr_action_taken&amp;gt;\w+),,(?&amp;lt;user_action_taken&amp;gt;\w+\s\w+),Begin:\.*Rule:\s(?&amp;lt;rule_used&amp;gt;.*),\d+,(?&amp;lt;process_called&amp;gt;.*),\d+,No\sModule\sName,(?&amp;lt;filename&amp;gt;.*),User:\s(?&amp;lt;user&amp;gt;\w+),Domain:\s(?&amp;lt;domain&amp;gt;\w+)" | table _time machine srvr_action_taken user_action_taken rule_used process_called filename user domain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(The table commands are just so I can view the output quickly.)&lt;/P&gt;

&lt;P&gt;Also, any suggestions for how I should use these two regexes in a props.conf EXTRACT entry/stanza?  I think that's probably the best way to proceed.&lt;BR /&gt;&lt;BR /&gt;
Would it make more sense to use a REPORT and have its transform employ DELIM instead?&lt;BR /&gt;
IS there a way to use both of these regexes against one source, in an EXTRACT or REPORT or transform?&lt;/P&gt;

&lt;P&gt;I imagine this will be an easy question for the Splunk Community, but the answer so far escapes me....Any help would be appreciated, I am just starting to learn Regex now....&lt;/P&gt;</description>
    <pubDate>Wed, 07 Nov 2012 21:04:50 GMT</pubDate>
    <dc:creator>gsawyer1</dc:creator>
    <dc:date>2012-11-07T21:04:50Z</dc:date>
    <item>
      <title>Regex help with Search time field extractions from syslog source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26907#M5218</link>
      <description>&lt;P&gt;I have a string of text from a syslog feed source:&lt;/P&gt;

&lt;P&gt;Nov  8 16:16:51 192.168.2.10 Nov  8 16:16:19 SuperServer PES0: Site: Sitename,Server: &lt;/P&gt;

&lt;P&gt;Srvr1,Domain: Default,Admin: user1,Policy has been fixed,Policyname - X&lt;/P&gt;

&lt;P&gt;I am trying to extract the last three fields from this data, and I can't seem to get it to work.  I'm only trying it out in Search first, but am thinking of using an EXTRACT in props.conf finally.  The rest of the regex I have doublechecked, using a Perl Regex editor and RegExr, too.  All of the syntax seems to be correct, until I try to extract the fields.  Here's the regex with search command I have so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    Source=syslog | rex ".*,Admin:\s(?&amp;lt;user&amp;gt;\w+),(?&amp;lt;message&amp;gt;.*),(?&amp;lt;policy&amp;gt;.*)" | table user message policy
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But my field extraction attempts here yield nothing so far.  Any suggestions?  &lt;/P&gt;

&lt;P&gt;My follow on issue is that I get additional logs from this same source:&lt;/P&gt;

&lt;P&gt;Nov  8 16:16:51 192.168.2.10 Nov  8 16:16:19 SuperServer PES0: MACHINE_NAME,Continue,,File Read,Begin: 2012-10-03 01:54:38,End: 2012-10-03 01:54:38,Rule: Log write - media,3196,C:/Windows/System32/svchost.exe,0,No Module Name,C:/Temp/filename.txt,User: SYSTEM,Domain: STANDALONE,Action Type:&lt;/P&gt;

&lt;P&gt;Here is the regex I have so far to extract fields from it, too:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Source=syslog | rex ".*PES0:\s(?&amp;lt;machine&amp;gt;\w+),(?&amp;lt;srvr_action_taken&amp;gt;\w+),,(?&amp;lt;user_action_taken&amp;gt;\w+\s\w+),Begin:\.*Rule:\s(?&amp;lt;rule_used&amp;gt;.*),\d+,(?&amp;lt;process_called&amp;gt;.*),\d+,No\sModule\sName,(?&amp;lt;filename&amp;gt;.*),User:\s(?&amp;lt;user&amp;gt;\w+),Domain:\s(?&amp;lt;domain&amp;gt;\w+)" | table _time machine srvr_action_taken user_action_taken rule_used process_called filename user domain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(The table commands are just so I can view the output quickly.)&lt;/P&gt;

&lt;P&gt;Also, any suggestions for how I should use these two regexes in a props.conf EXTRACT entry/stanza?  I think that's probably the best way to proceed.&lt;BR /&gt;&lt;BR /&gt;
Would it make more sense to use a REPORT and have its transform employ DELIM instead?&lt;BR /&gt;
IS there a way to use both of these regexes against one source, in an EXTRACT or REPORT or transform?&lt;/P&gt;

&lt;P&gt;I imagine this will be an easy question for the Splunk Community, but the answer so far escapes me....Any help would be appreciated, I am just starting to learn Regex now....&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2012 21:04:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26907#M5218</guid>
      <dc:creator>gsawyer1</dc:creator>
      <dc:date>2012-11-07T21:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help with Search time field extractions from syslog source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26908#M5219</link>
      <description>&lt;P&gt;Your rex command might be missing the parameter for the field to extract from. Take a look at the docs &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex"&gt;here&lt;/A&gt; for the rex command:&lt;/P&gt;

&lt;P&gt;In this case, try using the following snippet (remove the # symbols due to formatting):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw ".*,Admin:\s(?&amp;lt;#user&amp;gt;\w+),(?&amp;lt;#message&amp;gt;.*),(?&amp;lt;#policy&amp;gt;.*)" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Nov 2012 21:15:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26908#M5219</guid>
      <dc:creator>Rob</dc:creator>
      <dc:date>2012-11-07T21:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help with Search time field extractions from syslog source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26909#M5220</link>
      <description>&lt;P&gt;It would be great if that was the issu, and thanks for the clarification about specifying the field - I've seen so many examples here by now that my head is swimming with them, but I did actually already try specifying field=_raw - but my field count still doesn't increase, and my table command shows the headings I specified, but no data in them, still....&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2012 21:23:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26909#M5220</guid>
      <dc:creator>gsawyer1</dc:creator>
      <dc:date>2012-11-07T21:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help with Search time field extractions from syslog source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26910#M5221</link>
      <description>&lt;P&gt;The regex you are using for the first example should be ok. The only improvement I could suggest is to make the second field (message) not greedy with (?&lt;MESSAGE&gt;.*?). With the second regex, it looks like it just needs a few touches (There was an escaped dot in there):&lt;/MESSAGE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field=_raw .*PES0:\s(?&amp;lt;machine&amp;gt;\w+),(?&amp;lt;srvr_action_taken&amp;gt;\w+),,(?&amp;lt;user_action_taken&amp;gt;\w+\s\w+),Begin:.*?Rule:\s(?&amp;lt;rule_used&amp;gt;.*?),\d+,(?&amp;lt;process_called&amp;gt;.*?),\d+,No\sModule\sName,(?&amp;lt;filename&amp;gt;.*?),User:\s(?&amp;lt;user&amp;gt;\w+),Domain:\s(?&amp;lt;domain&amp;gt;\w+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Nov 2012 22:11:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26910#M5221</guid>
      <dc:creator>Rob</dc:creator>
      <dc:date>2012-11-07T22:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help with Search time field extractions from syslog source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26911#M5222</link>
      <description>&lt;P&gt;The way you would implement these in your transforms/props.conf is as follows:&lt;/P&gt;

&lt;P&gt;In transforms.conf you would actually define two separate transforms.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[foo]
REGEX = .*,Admin:\s(?&amp;lt;user&amp;gt;\w+),(?&amp;lt;message&amp;gt;.*),(?&amp;lt;policy&amp;gt;.*)

[bar]
REGEX = .*PES0:\s(?&amp;lt;machine&amp;gt;\w+),(?&amp;lt;srvr_action_taken&amp;gt;\w+),,(?&amp;lt;user_action_taken&amp;gt;\w+\s\w+),Begin:.*Rule:\s(?&amp;lt;rule_used&amp;gt;.*),\d+,(?&amp;lt;process_called&amp;gt;.*),\d+,No\sModule\sName,(?&amp;lt;filename&amp;gt;.*),User:\s(?&amp;lt;user&amp;gt;\w+),Domain:\s(?&amp;lt;domain&amp;gt;\w+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then in your props.conf you reference the above transforms like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[syslog]
REPORT-syslog = foo, bar
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Nov 2012 22:37:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26911#M5222</guid>
      <dc:creator>emiller42</dc:creator>
      <dc:date>2012-11-07T22:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help with Search time field extractions from syslog source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26912#M5223</link>
      <description>&lt;P&gt;Also, I forgot to mention that you will want to make sure that field discovery is turned on if you are using Splunk version &amp;lt;5.0 or your fields will not be extracted.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Nov 2012 22:40:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26912#M5223</guid>
      <dc:creator>Rob</dc:creator>
      <dc:date>2012-11-07T22:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help with Search time field extractions from syslog source</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26913#M5224</link>
      <description>&lt;P&gt;When I used the regex(s) in transforms, I had to put quotes around each comma.  Not so when I used the rex command in Search.  I also had to change a couple more "\w+" to ".*?" to capture all of the data to their fields.&lt;BR /&gt;&lt;BR /&gt;
Either way, thanks to both Rob and emiller42 for their help.  It felt good when things started working....&lt;BR /&gt;
Thanks!!  I have a follow-on question I am posting right now, called, "Subsequent transform of an extracted field?" if anyone wants to help....&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2012 15:14:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help-with-Search-time-field-extractions-from-syslog-source/m-p/26913#M5224</guid>
      <dc:creator>gsawyer1</dc:creator>
      <dc:date>2012-11-09T15:14:28Z</dc:date>
    </item>
  </channel>
</rss>

