<?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: Problem with using SOURCE_KEY in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40118#M178887</link>
    <description>&lt;P&gt;Perhaps could be hitting the problem described here: &lt;A href="http://blogs.splunk.com/2011/10/07/cannot-search-based-on-an-extracted-field/"&gt;http://blogs.splunk.com/2011/10/07/cannot-search-based-on-an-extracted-field/&lt;/A&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Dec 2011 17:55:17 GMT</pubDate>
    <dc:creator>_d_</dc:creator>
    <dc:date>2011-12-23T17:55:17Z</dc:date>
    <item>
      <title>Problem with using SOURCE_KEY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40116#M178885</link>
      <description>&lt;P&gt;I have some XML data that I parse into many fields, one of which is "relativePath"  why can't I get the transforms to extract a new field "fileName" from the SOURCE_KEY?  The rex command works fine in the search bar:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | rex field=relativePath "^.*[\\\/](?&amp;lt;fileName&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Sample Event:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;CheckEventRequest&amp;gt;
  &amp;lt;EventList count="1"&amp;gt;
    &amp;lt;Event event="0x20000" path="\\cepapoc.emcsplunk.com\CHECK$\server2fs1\davidpoc2" flag="0x2" protocol="0" server="CEPAPOC" share="server2fs1" clientIP="10.0.0.2" serverIP="10.0.0.4" timeStamp="0x4EF4883C00014D1D" userSid="S-1-5-21-175151209-4036982877-1867759480-500" ownerSid="S-1-5-32-544" fileSize="0x0" newName="\\cepapoc.emcsplunk.com\CHECK$\server2fs1\SplunkEMC" desiredAccess="0x0" createDispo="0x0" ntStatus="0x0" relativePath="\\CEPAPOC\server2fs1\davidpoc2"/&amp;gt;
  &amp;lt;/EventList&amp;gt;
&amp;lt;/CheckEventRequest&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[cepa]
LINE_BREAKER = ([\r\n]+20\d{2}/[01]\d/[0123]\d\s[012]\d:[0-5]\d:[0-5]\d[\r\n]+)
SHOULD_LINEMERGE = FALSE
TIME_PREFIX = timeStamp="
MAX_TIMESTAMP_LOOKAHEAD = 18
DATETIME_CONFIG = /etc/apps/vnx/default/emc-epoch.xml
REPORT-xmlkv = xmlkv-alternative
REPORT-getFileName = getFileName
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[xmlkv-alternative]
REGEX = &amp;lt;([^\s\&amp;gt;]*)[^\&amp;gt;]*\&amp;gt;([^&amp;lt;]*)\&amp;lt;\/\1\&amp;gt;
FORMAT = $1::$2
MV_ADD = True

[getFileName]
SOURCE_KEY = relativePath
REGEX = ^.*[\\\/](.*)
FORMAT = fileName::"$1"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Dec 2011 17:16:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40116#M178885</guid>
      <dc:creator>dmaislin_splunk</dc:creator>
      <dc:date>2011-12-23T17:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with using SOURCE_KEY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40117#M178886</link>
      <description>&lt;P&gt;See if this works: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[cepa]&lt;BR /&gt;
LINE_BREAKER = ([\r\n]+20\d{2}/[01]\d/[0123]\d\s[012]\d:[0-5]\d:[0-5]\d[\r\n]+)&lt;BR /&gt;
SHOULD_LINEMERGE = FALSE&lt;BR /&gt;
TIME_PREFIX = timeStamp="&lt;BR /&gt;
MAX_TIMESTAMP_LOOKAHEAD = 18&lt;BR /&gt;
DATETIME_CONFIG = /etc/apps/vnx/default/emc-epoch.xml&lt;BR /&gt;
REPORT-my_name = xmlkv-alternative, getFileName&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This particular &lt;CODE&gt;REPORT&lt;/CODE&gt; sequence insures that the &lt;CODE&gt;[xmlkv-alternative]&lt;/CODE&gt; transform stanza gets applied first, then &lt;CODE&gt;[getFileName]&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;gt; please upvote and accept answer if you find it useful - thanks!&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2011 17:44:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40117#M178886</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-12-23T17:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with using SOURCE_KEY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40118#M178887</link>
      <description>&lt;P&gt;Perhaps could be hitting the problem described here: &lt;A href="http://blogs.splunk.com/2011/10/07/cannot-search-based-on-an-extracted-field/"&gt;http://blogs.splunk.com/2011/10/07/cannot-search-based-on-an-extracted-field/&lt;/A&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2011 17:55:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40118#M178887</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-12-23T17:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with using SOURCE_KEY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40119#M178888</link>
      <description>&lt;P&gt;This is most likely related to a bad regex. Assuming relativePath="\CEPAPOC\server2fs1\davidpoc2" and that you want extract fileName=davidpoc2 then the following should do the trick (note the updated regex in getFileName)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;props.conf
[cepa] 
LINE_BREAKER = ([\r\n]+20\d{2}/[01]\d/[0123]\d\s[012]\d:[0-5]\d:[0-5]\d[\r\n]+)
SHOULD_LINEMERGE = FALSE TIME_PREFIX = timeStamp="
MAX_TIMESTAMP_LOOKAHEAD = 18 
DATETIME_CONFIG = /etc/apps/vnx/default/emc-epoch.xml 
REPORT-my_name = xmlkv-alternative, getFileName

transforms.conf
[xmlkv-alternative]
REGEX = &amp;lt;([^\s\&amp;gt;]*)[^\&amp;gt;]*\&amp;gt;([^&amp;lt;]*)\&amp;lt;\/\1\&amp;gt;
FORMAT = $1::$2
MV_ADD = True

[getFileName]
SOURCE_KEY = relativePath
# need to extract filenames from unix and windows paths, so use both forward/backward slashes
REGEX = (?&amp;lt;fileName&amp;gt;[^\\/]+)$
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Dec 2011 18:09:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40119#M178888</guid>
      <dc:creator>Ledion_Bitincka</dc:creator>
      <dc:date>2011-12-23T18:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with using SOURCE_KEY</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40120#M178889</link>
      <description>&lt;P&gt;The answer is.....&lt;/P&gt;

&lt;P&gt;The data was using autokv to extract all the delimited fields, not my xmlkv-alternative.  SOURCE_KEY does not work well with the default splunk autokv.  I replaced it with kv-alternative.&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[cepa]
LINE_BREAKER = ([\r\n]+20\d{2}/[01]\d/[0123]\d\s[012]\d:[0-5]\d:[0-5]\d[\r\n]+)
SHOULD_LINEMERGE = FALSE
TIME_PREFIX = timeStamp="
MAX_TIMESTAMP_LOOKAHEAD = 18
DATETIME_CONFIG = /etc/apps/vnx/default/emc-epoch.xml
REPORT-parsefields = kv-alternative,getFileName
TRANSFORMS-removehb = removehb
LOOKUP-event = eventlookup event OUTPUTNEW event_description
LOOKUP-dispo = dispolookup createDispo OUTPUTNEW createDispo_Description
KV_MODE = none
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[kv-alternative]
REGEX = (\w+)="([^"]+)"
FORMAT = $1::$2
MV_ADD = True

[getFileName]
SOURCE_KEY = relativePath
REGEX = (?&amp;lt;fileName&amp;gt;[^\\]+)$
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Dec 2011 18:56:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-with-using-SOURCE-KEY/m-p/40120#M178889</guid>
      <dc:creator>dmaislin_splunk</dc:creator>
      <dc:date>2011-12-23T18:56:48Z</dc:date>
    </item>
  </channel>
</rss>

