<?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: add dynamic field in splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/add-dynamic-field-in-splunk/m-p/53297#M12962</link>
    <description>&lt;P&gt;If I understand your question correctly, you want to extract a field from the "source" metadata associated with the event.  (That is, not from the "_raw" event text.)  As far as I know, the only way to do that is to create an indexed field.  There are a number of caveats that go along with creating indexed fields - I would recommend discussing your exact scenario and its performance and other implications with Splunk support.  That said, we use this as a basic formula for pulling indexed fields from "source":&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(props.conf)
[tougou]
TRANSFORMS-guest=togou_guest

(transforms.conf)
[togou_guest]
SOURCE_KEY=MetaData:Source
REGEX=ntt_tougou\\tougou_logs\\([^\\]+)\\
FORMAT=guest::$1
WRITE_META=true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(I am a little unsure on the backslashes and how many are needed in the regex example.  My day job is not Windows)&lt;/P&gt;

&lt;P&gt;Docs related to this are at: &lt;A href="http://www.splunk.com/base/Documentation/latest/Admin/Configureindex-timefieldextraction" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/latest/Admin/Configureindex-timefieldextraction&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Mar 2011 22:26:22 GMT</pubDate>
    <dc:creator>dwaddle</dc:creator>
    <dc:date>2011-03-03T22:26:22Z</dc:date>
    <item>
      <title>add dynamic field in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-dynamic-field-in-splunk/m-p/53296#M12961</link>
      <description>&lt;P&gt;Hi everyone , i would like to add a field in splunk.but field value does not come in result.&lt;/P&gt;

&lt;P&gt;here my source are:-
1. C:\Program Files\Splunk\etc\apps\tougou\tougou_logs\guest1\host_name\afkcd01_KLZ_Disk_110208.csv
2. C:\Program Files\Splunk\etc\apps\tougou\tougou_logs\guest2\host_name\afkcd01_KLZ_Disk_110208.csv
C:\Program Files\Splunk\etc\apps\tougou\tougou_logs\guest3\host_name\afkcd01_KLZ_Disk_110208.csv&lt;/P&gt;

&lt;P&gt;i want add field with name guest, as above sources there are diffirent diffirent guest like
guest1, guest2 and guest. so i would like serch result based on guest field
 like:- 
index = "tougou" guest="guest1"
index = "tougou" guest="guest2"
as we know source always come in result. but i dont know how to add field guest in splunk.
please help me to resolve this problem.
thanx in advnce.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2011 19:05:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-dynamic-field-in-splunk/m-p/53296#M12961</guid>
      <dc:creator>chandansingh</dc:creator>
      <dc:date>2011-03-03T19:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: add dynamic field in splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-dynamic-field-in-splunk/m-p/53297#M12962</link>
      <description>&lt;P&gt;If I understand your question correctly, you want to extract a field from the "source" metadata associated with the event.  (That is, not from the "_raw" event text.)  As far as I know, the only way to do that is to create an indexed field.  There are a number of caveats that go along with creating indexed fields - I would recommend discussing your exact scenario and its performance and other implications with Splunk support.  That said, we use this as a basic formula for pulling indexed fields from "source":&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(props.conf)
[tougou]
TRANSFORMS-guest=togou_guest

(transforms.conf)
[togou_guest]
SOURCE_KEY=MetaData:Source
REGEX=ntt_tougou\\tougou_logs\\([^\\]+)\\
FORMAT=guest::$1
WRITE_META=true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(I am a little unsure on the backslashes and how many are needed in the regex example.  My day job is not Windows)&lt;/P&gt;

&lt;P&gt;Docs related to this are at: &lt;A href="http://www.splunk.com/base/Documentation/latest/Admin/Configureindex-timefieldextraction" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/latest/Admin/Configureindex-timefieldextraction&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2011 22:26:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-dynamic-field-in-splunk/m-p/53297#M12962</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2011-03-03T22:26:22Z</dc:date>
    </item>
  </channel>
</rss>

