<?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: Creating Custom Field Extractions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Creating-Custom-Field-Extractions/m-p/461441#M130137</link>
    <description>&lt;P&gt;You are absolutely on the right path.   &lt;/P&gt;

&lt;P&gt;Your sourcetype definition in props.conf would look something like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[SOURCETYPENAME]
disabled = false
LINE_BREAKER = [\r\n]+                             # = Break on every line
SHOULD_LINEMERGE = false                           # = Use basic line break detection
TIME_PREFIX = ^\[                                  # = what comes before the timestamp
TIME_FORMAT = %Y-%m-%d %H:%M:%S,%3N                # = strftime representation of the timestamp
MAX_TIMESTAMP_LOOKAHEAD = 25                       # = stop looking for timestamp after 25 chars

EXTRACT-01-Fields = ^\[[^\]]+\]\s+\[(?&amp;lt;firstfieldname&amp;gt;[^\]]+)\]\s+\[(?&amp;lt;secondfieldname&amp;gt;[^\]]+)\]\s+\[(?&amp;lt;thirdfieldname&amp;gt;[^\]]+)\]\s+\[(?&amp;lt;fourthfieldname&amp;gt;[^\]]+)\]\s+\[(?&amp;lt;username&amp;gt;[^\]]+)\]\s+(?&amp;lt;message&amp;gt;.+)$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is how the regex looks in regex101:     &lt;A href="https://regex101.com/r/LOwRwN/1"&gt;https://regex101.com/r/LOwRwN/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps..&lt;BR /&gt;&lt;BR /&gt;
./D&lt;/P&gt;</description>
    <pubDate>Mon, 30 Mar 2020 15:03:18 GMT</pubDate>
    <dc:creator>darrenfuller</dc:creator>
    <dc:date>2020-03-30T15:03:18Z</dc:date>
    <item>
      <title>Creating Custom Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Custom-Field-Extractions/m-p/461440#M130136</link>
      <description>&lt;P&gt;I am trying to add some field extractions for a log file created by Entrust IdentityGurard authentication solution. Currently when I read it in I read it with a SourceType of log4j as the application outlines it formats the logs in. Things look okay but the fields specific to the log are not being extracted. I am looking into how I can build a custom extraction myself because I have always wanted to learn how it works but figured I would also post the question here to get some tips and best practices.  &lt;/P&gt;

&lt;P&gt;Here is an example of one event in the log file:&lt;BR /&gt;
[2020-03-29 18:37:51,020] [IG Audit Writer] [INFO ] [IG.AUDIT] [AUD6012] [UserNameHere] EventMessageHere&lt;/P&gt;

&lt;P&gt;Basically, all the fields I want are wrapped in square brackets [] and the message itself is just added at the end with no square brackets.&lt;/P&gt;

&lt;P&gt;I think I will have to build out my own custom SourceType in the SplunkHome\etc\system\local\props.conf that will just be a copy of the log4j stanza but with either a REPORT key that references a corresponding extraction in the transforms.conf file or use the EXTRACT key and put it in there using regex. Am I on the right path?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 14:38:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Custom-Field-Extractions/m-p/461440#M130136</guid>
      <dc:creator>snix</dc:creator>
      <dc:date>2020-03-30T14:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Custom Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Custom-Field-Extractions/m-p/461441#M130137</link>
      <description>&lt;P&gt;You are absolutely on the right path.   &lt;/P&gt;

&lt;P&gt;Your sourcetype definition in props.conf would look something like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[SOURCETYPENAME]
disabled = false
LINE_BREAKER = [\r\n]+                             # = Break on every line
SHOULD_LINEMERGE = false                           # = Use basic line break detection
TIME_PREFIX = ^\[                                  # = what comes before the timestamp
TIME_FORMAT = %Y-%m-%d %H:%M:%S,%3N                # = strftime representation of the timestamp
MAX_TIMESTAMP_LOOKAHEAD = 25                       # = stop looking for timestamp after 25 chars

EXTRACT-01-Fields = ^\[[^\]]+\]\s+\[(?&amp;lt;firstfieldname&amp;gt;[^\]]+)\]\s+\[(?&amp;lt;secondfieldname&amp;gt;[^\]]+)\]\s+\[(?&amp;lt;thirdfieldname&amp;gt;[^\]]+)\]\s+\[(?&amp;lt;fourthfieldname&amp;gt;[^\]]+)\]\s+\[(?&amp;lt;username&amp;gt;[^\]]+)\]\s+(?&amp;lt;message&amp;gt;.+)$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is how the regex looks in regex101:     &lt;A href="https://regex101.com/r/LOwRwN/1"&gt;https://regex101.com/r/LOwRwN/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps..&lt;BR /&gt;&lt;BR /&gt;
./D&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 15:03:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Custom-Field-Extractions/m-p/461441#M130137</guid>
      <dc:creator>darrenfuller</dc:creator>
      <dc:date>2020-03-30T15:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Custom Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Custom-Field-Extractions/m-p/461442#M130138</link>
      <description>&lt;P&gt;Holy you know what... That is exactly what I am looking for. Thank you for such a great and specific example! You even built out how to pull in the time from the logs which I had no idea how to do but was going to be the next part to figure out.  &lt;/P&gt;

&lt;P&gt;I was able to implemented it and verify it works exactly how I wanted. &lt;BR /&gt;
Thank you!!!!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 17:41:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Custom-Field-Extractions/m-p/461442#M130138</guid>
      <dc:creator>snix</dc:creator>
      <dc:date>2020-03-30T17:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Custom Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Creating-Custom-Field-Extractions/m-p/461443#M130139</link>
      <description>&lt;P&gt;After looking closer at it I did find most of the events contained a combination of multiple events into one event. Not sure why because I would think what you have would work. I don't pretend to understand much about return carriages and new lines in the little amount of programing I have to deal with but it looked good.&lt;/P&gt;

&lt;P&gt;I took some of the output from the log file and pasted it into Notpad++ and did a show of all characters and it showed CR LF at the end of each line so that looks good to me.&lt;/P&gt;

&lt;P&gt;That said I commented out the LINE_BREAKER line and replaced it with "BREAK_ONLY_BEFORE = \d\d?:\d\d:\d\d" which I found under the log4j stanza and it worked. Since I don't grasp 100% what I am doing I am sure this is not the best way to do it but it did get the results I was looking for.&lt;/P&gt;

&lt;P&gt;If someone understands what is going on and would like to explain it I am all ears. I think this will end up being a good post in general for others trying to do something similar and just needs a useful example of what it would look like.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:47:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Creating-Custom-Field-Extractions/m-p/461443#M130139</guid>
      <dc:creator>snix</dc:creator>
      <dc:date>2020-09-30T04:47:36Z</dc:date>
    </item>
  </channel>
</rss>

