<?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 to define sourcetype for new file format in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98635#M25394</link>
    <description>&lt;P&gt;you can use the &lt;CODE&gt;mvindex()&lt;/CODE&gt; eval function on your multi-value lists, but you first need to convert it from a string to a mvlist, using either the &lt;CODE&gt;makemv&lt;/CODE&gt; search command, the &lt;CODE&gt;split()&lt;/CODE&gt; eval function, or by defining an additional REPORT extraction (that runs after the main one you already have) for each field that operates on the originallly extracted list and puts the values in a list with the MV_ADD option.&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2011 13:36:34 GMT</pubDate>
    <dc:creator>gkanapathy</dc:creator>
    <dc:date>2011-05-11T13:36:34Z</dc:date>
    <item>
      <title>How to define sourcetype for new file format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98630#M25389</link>
      <description>&lt;P&gt;I'm a newbie, so go easy please.&lt;/P&gt;

&lt;P&gt;I have a file structure that has field groups separated by ; and within each group there is 1 or more values.  For example the line&lt;/P&gt;

&lt;P&gt;000101;102;356;3284;4,2;0;UserName,UserId;2011-05-02 07:24:25.275;63,15;0,9;id=xx,q=name&lt;/P&gt;

&lt;P&gt;equates to the following &lt;/P&gt;

&lt;P&gt;Service = 000101&lt;BR /&gt;&lt;BR /&gt;
Cmd = 102&lt;BR /&gt;&lt;BR /&gt;
Pid = 356&lt;BR /&gt;&lt;BR /&gt;
Tid = 3284&lt;BR /&gt;&lt;BR /&gt;
Counts = 4,2 (2 different counters)&lt;BR /&gt;&lt;BR /&gt;
Result = 0&lt;BR /&gt;&lt;BR /&gt;
User = UserName,Id&lt;BR /&gt;&lt;BR /&gt;
Date = 2011-05-02 07:24:25.275&lt;BR /&gt;&lt;BR /&gt;
&lt;B&gt;--- All data records are constant syntax up to this point, followed by&lt;/B&gt;&lt;BR /&gt;&lt;BR /&gt;
Timers = 63,15 - contains 1..n timers - first is total elapsed time&lt;BR /&gt;&lt;BR /&gt;
Values = 0,9 - contains 1..n values related to Cmd 102&lt;BR /&gt;&lt;BR /&gt;
Fields = id=xx,q=name (contains 1..n key/value pairs - related to Cmd 102)&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;I've read lots about sourcetypes, props.conf, inputs.conf, index time and search time and so on but just can't quite join the dots to work out how to make splunk extract the data and assign it to these named fields.&lt;/P&gt;

&lt;P&gt;Can anyone start me with the first dot and point me in the right direction&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2011 06:37:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98630#M25389</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2011-05-10T06:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to define sourcetype for new file format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98631#M25390</link>
      <description>&lt;P&gt;In props.conf (just put it on all machines, forwarders, indexers, and search heads; look &lt;A href="http://www.splunk.com/wiki/Where_do_I_configure_my_Splunk_settings%3F"&gt;here&lt;/A&gt; if you really want the details) put:&lt;/P&gt;

&lt;P&gt;props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mynewsourcetype]
SHOULD_LINEMERGE = false
TIME_PREFIX=^(?:[^;]*;){7}
TIME_FORMAT=%Y-%m-%d %H:%M:%S.%3N
REPORT-mynewsourcetypefields = mynewsourcetypefields
KV_MODE = auto
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf could be one of multiple possible versions. Simple one is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mynewsourcetypefields]
DELIMS=";,"
FIELDS = Service,Cmd,Pid,Tid,Count1,Count2,UserName,UserId,DateTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;A more complete one is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mynewsourcetypefields]
REGEX = ^(?&amp;lt;Service&amp;gt;[^;]*);(?&amp;lt;Cmd&amp;gt;[^;]*);(?&amp;lt;Pid&amp;gt;[^;]*);(?&amp;lt;Tid&amp;gt;[^;]*)(?&amp;lt;Count1&amp;gt;[^,]*),(?&amp;lt;Count2&amp;gt;[^;]*);(?&amp;lt;UserName&amp;gt;[^,]*),(?&amp;lt;UserId&amp;gt;[^;]*);(?&amp;lt;DateTime&amp;gt;[^;]*);(?:(?&amp;lt;Timers&amp;gt;[^;]*);)?(?:(?&amp;lt;Values&amp;gt;[^;]*);)?
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 May 2011 14:02:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98631#M25390</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-05-10T14:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to define sourcetype for new file format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98632#M25391</link>
      <description>&lt;P&gt;Update....&lt;/P&gt;

&lt;P&gt;After a bit of mistakes and fiddling with props.conf and transforms.conf in etc/system/local, I got the fields to be recognised, by setting a manual sourcetype=server_instr when adding data.  However, I also need to be able to split the Timers, Values and Fields depending on certain criteria in the data, e.g. if Cmd=102, the if Value[0] == 3 then count of Timers = X, so how can I do this.  I also want to search, e.g. Cmd=102 &amp;amp;&amp;amp; Timer[4] &amp;gt; 3000.  How can I do this?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2011 02:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98632#M25391</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2011-05-11T02:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to define sourcetype for new file format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98633#M25392</link>
      <description>&lt;P&gt;Update....&lt;BR /&gt;
In transforms.conf, for Date onwards, I have &lt;/P&gt;

&lt;P&gt;....;(?&lt;DATETIME&gt;[^;]&lt;EM&gt;);(?:(?&lt;TIMERS&gt;[^;]&lt;/TIMERS&gt;&lt;/EM&gt;);)?(?:(?&lt;VALUES&gt;[^;]&lt;EM&gt;);)?(?:(?&lt;FIELDS&gt;[^;]&lt;/FIELDS&gt;&lt;/EM&gt;);)&lt;/VALUES&gt;&lt;/DATETIME&gt;&lt;/P&gt;

&lt;P&gt;I don't fully understand the regex, but I am never getting any 'Values' field found and in a line that has&lt;/P&gt;

&lt;P&gt;1672,32,0,1640;0,0,1,1,42;&lt;/P&gt;

&lt;P&gt;which represents 1672,32,0,1640 as Timers and 0,0,1,1,42 as Values and there are no Fields, Splunk says that 1672,32,0,1640 are Timers and 0,0,1,1,42 are Fields, but no Values, so can anyone say what's wrong with the regex above?  In my original post I said that Values/Fields can be 1..n, but it's 0..n&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2011 02:37:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98633#M25392</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2011-05-11T02:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to define sourcetype for new file format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98634#M25393</link>
      <description>&lt;P&gt;Update....&lt;/P&gt;

&lt;P&gt;I finally got the regex going&lt;/P&gt;

&lt;P&gt;REGEX = ^(?&lt;SERVICE&gt;[^;]&lt;EM&gt;);(?&lt;CMD&gt;[^;]&lt;/CMD&gt;&lt;/EM&gt;);(?&lt;PID&gt;[^;]&lt;EM&gt;);(?&lt;TID&gt;[^;]&lt;/TID&gt;&lt;/EM&gt;);(?&lt;TOTCMDS&gt;[^,]&lt;EM&gt;),(?&lt;THISCMDS&gt;[^;]&lt;/THISCMDS&gt;&lt;/EM&gt;);(?&lt;STATUS&gt;[^;]&lt;EM&gt;);(?&lt;USERNAME&gt;[^,]&lt;/USERNAME&gt;&lt;/EM&gt;),(?&lt;USERID&gt;[^;]&lt;EM&gt;);(?&lt;DATETIME&gt;[^;]&lt;/DATETIME&gt;&lt;/EM&gt;);(?:(?&lt;TIMERS&gt;[^;]&lt;EM&gt;);)?(?:(?&lt;VALUES&gt;[^;]&lt;/VALUES&gt;&lt;/EM&gt;);)?(?:(?&lt;FIELDS&gt;[^;]*)$)?&lt;/FIELDS&gt;&lt;/TIMERS&gt;&lt;/USERID&gt;&lt;/STATUS&gt;&lt;/TOTCMDS&gt;&lt;/PID&gt;&lt;/SERVICE&gt;&lt;/P&gt;

&lt;P&gt;but is there a way to use the Timers and Values fields as an array of values within those fields, so they can be referenced in such a way as Timers[3] or will I have to use rex during the search to make dynamic fields from the Timers field?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2011 06:54:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98634#M25393</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2011-05-11T06:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to define sourcetype for new file format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98635#M25394</link>
      <description>&lt;P&gt;you can use the &lt;CODE&gt;mvindex()&lt;/CODE&gt; eval function on your multi-value lists, but you first need to convert it from a string to a mvlist, using either the &lt;CODE&gt;makemv&lt;/CODE&gt; search command, the &lt;CODE&gt;split()&lt;/CODE&gt; eval function, or by defining an additional REPORT extraction (that runs after the main one you already have) for each field that operates on the originallly extracted list and puts the values in a list with the MV_ADD option.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2011 13:36:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98635#M25394</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-05-11T13:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to define sourcetype for new file format</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98636#M25395</link>
      <description>&lt;P&gt;Thanks gkanapathy, great help - so many ways to achieve the same thing, wow this is powerful.&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2011 03:29:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-define-sourcetype-for-new-file-format/m-p/98636#M25395</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2011-05-12T03:29:33Z</dc:date>
    </item>
  </channel>
</rss>

