<?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: define custom fixed fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61969#M15295</link>
    <description>&lt;P&gt;Please explain in more detail what you want to achieve. My impression is that you want to create a field based on a match on a certain size of a word surrounded by whitespace in a log? I.e. in the following event&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2011-03-15 03:18  foo fooba gazonk yiff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;"field1" should match "foo", "field2" should match "fooba". Is this what you mean? In that case you can certainly do that, however could you please first acknowledge whether I'm correct in my assumption about what you want to achieve.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Mar 2011 22:50:31 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2011-03-17T22:50:31Z</dc:date>
    <item>
      <title>define custom fixed fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61968#M15294</link>
      <description>&lt;P&gt;Is there any way to define custom fields which have a fixed size?&lt;/P&gt;

&lt;P&gt;For instance:
We can have field definition as:
field 1: 3 characters
field 2: 5 characters
field 3: 120 characters
total: 128 characters&lt;/P&gt;

&lt;P&gt;And we'd like to have it separated and be able to search this fields.&lt;/P&gt;

&lt;P&gt;Any suggestion?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2011 22:34:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61968#M15294</guid>
      <dc:creator>acalvo</dc:creator>
      <dc:date>2011-03-17T22:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: define custom fixed fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61969#M15295</link>
      <description>&lt;P&gt;Please explain in more detail what you want to achieve. My impression is that you want to create a field based on a match on a certain size of a word surrounded by whitespace in a log? I.e. in the following event&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2011-03-15 03:18  foo fooba gazonk yiff
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;"field1" should match "foo", "field2" should match "fooba". Is this what you mean? In that case you can certainly do that, however could you please first acknowledge whether I'm correct in my assumption about what you want to achieve.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2011 22:50:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61969#M15295</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2011-03-17T22:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: define custom fixed fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61970#M15296</link>
      <description>&lt;P&gt;yes, you are correct&lt;BR /&gt;&lt;BR /&gt;
so in your example, fooba could be field2 with 6 characters (note the starting whitespace)&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2011 23:36:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61970#M15296</guid>
      <dc:creator>acalvo</dc:creator>
      <dc:date>2011-03-17T23:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: define custom fixed fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61971#M15297</link>
      <description>&lt;P&gt;I would do a field extraction as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;Field1&amp;gt;.{3})(?&amp;lt;Field2&amp;gt;.{5})(?&amp;lt;Field3&amp;gt;.{120})$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The dollar sign will ensure that you're grabbing from the end of the line (making sure that you don't start Field1 in a timestamp, or anything like that).&lt;/P&gt;

&lt;P&gt;You can either toss that in your props.conf, or do a search like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;YourSearch | rex field=_raw "(?&amp;lt;Field1&amp;gt;.{3})(?&amp;lt;Field2&amp;gt;.{5})(?&amp;lt;Field3&amp;gt;.{120})$" | table Field1 Field2 Field3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(Note that if your _raw doesn't have at least 128 characters, it won't extract any fields)&lt;/P&gt;

&lt;P&gt;Added: Your props.conf might look like the below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
EXTRACT-FixedFields = (?&amp;lt;Field1&amp;gt;.{3})(?&amp;lt;Field2&amp;gt;.{5})(?&amp;lt;Field3&amp;gt;.{120})$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And you can replace yoursourcetype with (from the documentation):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1. &amp;lt;sourcetype&amp;gt;, the source type of an event.
2. host::&amp;lt;host&amp;gt;, where &amp;lt;host&amp;gt; is the host for an event.
3. source::&amp;lt;source&amp;gt;, where &amp;lt;source&amp;gt; is the source for an event.
4. rule::&amp;lt;rulename&amp;gt;, where &amp;lt;rulename&amp;gt; is a unique name of a source type classification rule.
5. delayedrule::&amp;lt;rulename&amp;gt;, where &amp;lt;rulename&amp;gt; is a unique name of a delayed source type classification rule.
These are only considered as a last resort before generating a new source type based on the source seen.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See the props.conf doc for more:
&lt;A href="http://www.splunk.com/base/Documentation/latest/admin/propsconf" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/latest/admin/propsconf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2011 23:46:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61971#M15297</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2011-03-17T23:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: define custom fixed fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61972#M15298</link>
      <description>&lt;P&gt;That's what I was looking for.&lt;BR /&gt;&lt;BR /&gt;
However, could you post an example for props.conf?&lt;BR /&gt;&lt;BR /&gt;
Will the fields by indexed or just used at search time?&lt;BR /&gt;&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2011 14:57:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61972#M15298</guid>
      <dc:creator>acalvo</dc:creator>
      <dc:date>2011-03-18T14:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: define custom fixed fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61973#M15299</link>
      <description>&lt;P&gt;Sure. I just added it to the main response (so it wouldn't lose the formatting). The fields would be used at search time, as is the preferred way with Splunk. If you did want to go index-time, you can read that documentation (I've never done it myself): &lt;A href="http://www.splunk.com/base/Documentation/4.2/Data/Configureindex-timefieldextraction"&gt;http://www.splunk.com/base/Documentation/4.2/Data/Configureindex-timefieldextraction&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2011 23:41:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/define-custom-fixed-fields/m-p/61973#M15299</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2011-03-18T23:41:38Z</dc:date>
    </item>
  </channel>
</rss>

