<?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: How can I do field extraction on a security log using regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375742#M110400</link>
    <description>&lt;P&gt;use like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=A |makemv _raw delim=","|eval field0=mvindex(_raw,0),field1=mvindex(_raw,1),field2=mvindex(_raw,2),field3=mvindex(_raw,3),field4=mvindex(_raw,4),field5=mvindex(_raw,5),field6=mvindex(_raw,6),field7=mvindex(_raw,7)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Feb 2018 15:01:14 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2018-02-15T15:01:14Z</dc:date>
    <item>
      <title>How can I do field extraction on a security log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375736#M110394</link>
      <description>&lt;P&gt;I need a little guidance on rex field extraction on the following "redacted" security log.  Unfortunately, I don't have permission to use field extraction gui so need to rex in the search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2018:02:09-23:04:30 blahblah httpd[11111], : [foo-security:error],  [pid 12345:tid 1234567890],  [client 192.168.1.1],  Foo-Security: Warning. Pattern match "some expression..." at ARGS:file. [file "some_attack.conf"],  [line "111"],  [id "111"],  [rev "1"],  [msg "Some Attack: blah blah Detected."],  [data "Matched Data: blah blah ARGS:file: &amp;lt;foo=bar"],  [severity "CRITICAL"],  [ver "foo/2.2. [hostname "bar.com"],  [uri "/foo/bar/foobar"],  [unique_id "a1b2c3-a1b2c3"], 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see, there are commas and [ brackets] delimiting the log and splunk is extracting some fields like the time field correctly, but I would  like to extract more fields&lt;/P&gt;

&lt;P&gt;like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2018:02:09-23:04:30 
blahblah httpd[11111], : &amp;lt;-----------field 1
[foo-security:error],  &amp;lt;-----------field 2 
[pid 12345:tid 1234567890],  &amp;lt;-----------field 3
[client 192.168.1.1],  &amp;lt;-----------field 4
Foo-Security: Warning. Pattern match "some expression..." at ARGS:file. &amp;lt;-----------field 5
[file "some_attack.conf"],  &amp;lt;-----------field 6
[line "111"],  &amp;lt;-----------field 7
[id "111"],  &amp;lt;-----------field 8
[rev "1"],  &amp;lt;-----------field 9
[msg "Some Attack: blah blah Detected."],  &amp;lt;-----------field 10
[data "Matched Data: blah blah ARGS:file: &amp;lt;foo=bar"],  &amp;lt;-----------field 11
[severity "CRITICAL"],  &amp;lt;-----------field 12
[ver "foo/2.2. [hostname "bar.com"],  &amp;lt;-----------field 13
[uri "/foo/bar/foobar"],  &amp;lt;-----------field 14
[unique_id "a1b2c3-a1b2c3"], &amp;lt;-----------field 15
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am a bit rusty on this so any help is much appreciated.&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 14 Feb 2018 22:48:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375736#M110394</guid>
      <dc:creator>Log_wrangler</dc:creator>
      <dc:date>2018-02-14T22:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do field extraction on a security log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375737#M110395</link>
      <description>&lt;P&gt;for msg field number 10   would the following spl code be correct?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | regex _raw="msg+.[^],]*     
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 02:09:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375737#M110395</guid>
      <dc:creator>Log_wrangler</dc:creator>
      <dc:date>2018-02-15T02:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do field extraction on a security log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375738#M110396</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Try like this run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval _raw="2018:02:09-23:04:30 blahblah httpd[11111], : [foo-security:error],  [pid 12345:tid 1234567890],  [client 192.168.1.1],  Foo-Security: Warning. Pattern match \"some expression...\" at ARGS:file. [file \"some_attack.conf\"],  [line \"111\"],  [id \"111\"],  [rev \"1\"],  [msg \"Some Attack: blah blah Detected.\"],  [data \"Matched Data: blah blah ARGS:file: &amp;lt;foo=bar\"],  [severity \"CRITICAL\"],  [ver \"foo/2.2. [hostname \"bar.com\"],  [uri \"/foo/bar/foobar\"],  [unique_id \"a1b2c3-a1b2c3\"], "|rex "^[\d\:]+-[\d\:]+(?&amp;lt;_raw&amp;gt;.*)"|makemv _raw delim=","|eval field0=mvindex(_raw,0),field1=mvindex(_raw,1),field2=mvindex(_raw,2),field3=mvindex(_raw,3),field4=mvindex(_raw,4),field5=mvindex(_raw,5),field6=mvindex(_raw,6),field7=mvindex(_raw,7)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 04:02:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375738#M110396</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-15T04:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do field extraction on a security log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375739#M110397</link>
      <description>&lt;P&gt;Thank you for the reply.   Maybe I am misunderstanding or I did not explain clearly.&lt;/P&gt;

&lt;P&gt;I was looking for a way that will eval all the log events in _raw, without having to copy and paste like above.&lt;/P&gt;

&lt;P&gt;The example I provided is the un-parsed / un-extracted raw text I need to rex into usable fields.   Does that make sense...?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 14:52:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375739#M110397</guid>
      <dc:creator>Log_wrangler</dc:creator>
      <dc:date>2018-02-15T14:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do field extraction on a security log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375740#M110398</link>
      <description>&lt;P&gt;the logs are in an index=A  and sourcetype = A, etc...  is there a way to use your method with a specific index and sourcetype?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 14:56:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375740#M110398</guid>
      <dc:creator>Log_wrangler</dc:creator>
      <dc:date>2018-02-15T14:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do field extraction on a security log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375741#M110399</link>
      <description>&lt;P&gt;if the event is already indexed then have you tried this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base_search&amp;gt;|makemv _raw delim=","|eval field0=mvindex(_raw,0),field1=mvindex(_raw,1),field2=mvindex(_raw,2),field3=mvindex(_raw,3),field4=mvindex(_raw,4),field5=mvindex(_raw,5),field6=mvindex(_raw,6),field7=mvindex(_raw,7)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here in &lt;CODE&gt;&amp;lt;base search&amp;gt;&lt;/CODE&gt; include the query from where you are getting events/raw text like &lt;CODE&gt;index=indexname&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 14:59:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375741#M110399</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-15T14:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I do field extraction on a security log using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375742#M110400</link>
      <description>&lt;P&gt;use like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=A |makemv _raw delim=","|eval field0=mvindex(_raw,0),field1=mvindex(_raw,1),field2=mvindex(_raw,2),field3=mvindex(_raw,3),field4=mvindex(_raw,4),field5=mvindex(_raw,5),field6=mvindex(_raw,6),field7=mvindex(_raw,7)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 15:01:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-do-field-extraction-on-a-security-log-using-regex/m-p/375742#M110400</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-15T15:01:14Z</dc:date>
    </item>
  </channel>
</rss>

