<?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 Extract fields from filename and put it into event in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Extract-fields-from-filename-and-put-it-into-event/m-p/388820#M69606</link>
    <description>&lt;P&gt;I wang to extract field from event source filename.&lt;BR /&gt;
The file path format shows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;D:\soft\logs\fv_1_Tom_lab1_20180701.txt
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want get two fields in my events&lt;BR /&gt;
such as username=Tom; project=lab1&lt;/P&gt;

&lt;P&gt;what should I do ?&lt;BR /&gt;
How can I confige my &lt;CODE&gt;props.conf a&lt;/CODE&gt;nd &lt;CODE&gt;transforms.conf&lt;/CODE&gt;  ,I use SplunkForward to forward my data&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jul 2018 07:48:44 GMT</pubDate>
    <dc:creator>WXY</dc:creator>
    <dc:date>2018-07-31T07:48:44Z</dc:date>
    <item>
      <title>Extract fields from filename and put it into event</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-fields-from-filename-and-put-it-into-event/m-p/388820#M69606</link>
      <description>&lt;P&gt;I wang to extract field from event source filename.&lt;BR /&gt;
The file path format shows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;D:\soft\logs\fv_1_Tom_lab1_20180701.txt
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want get two fields in my events&lt;BR /&gt;
such as username=Tom; project=lab1&lt;/P&gt;

&lt;P&gt;what should I do ?&lt;BR /&gt;
How can I confige my &lt;CODE&gt;props.conf a&lt;/CODE&gt;nd &lt;CODE&gt;transforms.conf&lt;/CODE&gt;  ,I use SplunkForward to forward my data&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2018 07:48:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-fields-from-filename-and-put-it-into-event/m-p/388820#M69606</guid>
      <dc:creator>WXY</dc:creator>
      <dc:date>2018-07-31T07:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from filename and put it into event</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-fields-from-filename-and-put-it-into-event/m-p/388821#M69607</link>
      <description>&lt;P&gt;can you show some sample events  to understand better&lt;BR /&gt;
from your explanation you can try:&lt;BR /&gt;
in props.conf -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype_name]
 REPORT-myUniqueClassName = myTransform
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in transforms.conf -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[myTransform]
  REGEX = (\w+)=(\w+)
  FORMAT = $1::$2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jul 2018 07:56:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-fields-from-filename-and-put-it-into-event/m-p/388821#M69607</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-07-31T07:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from filename and put it into event</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-fields-from-filename-and-put-it-into-event/m-p/388822#M69608</link>
      <description>&lt;P&gt;You could try this? &lt;/P&gt;

&lt;P&gt;props.conf&lt;BR /&gt;
[your_sourcetype]&lt;BR /&gt;
EXTRACT-username,project = ^.*?\logs\D+\d_(?[^&lt;EM&gt;]+)&lt;/EM&gt;(?[^_]+) in source&lt;/P&gt;

&lt;P&gt;You will need to adjust the regex as I made it pretty quick and it is unlikely to match all the cases you have which you haven't provided.&lt;/P&gt;

&lt;P&gt;Credit/Source: &lt;A href="https://answers.splunk.com/answers/600776/multiple-fields-extractionm-using-propsconf.html" target="_blank"&gt;https://answers.splunk.com/answers/600776/multiple-fields-extractionm-using-propsconf.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:41:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-fields-from-filename-and-put-it-into-event/m-p/388822#M69608</guid>
      <dc:creator>WalshyB</dc:creator>
      <dc:date>2020-09-29T20:41:38Z</dc:date>
    </item>
  </channel>
</rss>

