<?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 How to Extract the host values from the path? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/597932#M104339</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I am new to splunk. I've got trouble when I was trying to get host values from the path.&lt;/P&gt;
&lt;P&gt;The directory I set is&amp;nbsp;D:\14. splunk\SMT\. No matter what kind of extract function i was using: regex or segment, it doesn't work.&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;P&gt;The host name of the following file should be "PCXXXXX", but it still shows the default host name .&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture-2.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19653i84E786E3AE0882B3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture-2.PNG" alt="Capture-2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;However, I already set the host name with regex on path, but it doesn't work...&lt;/P&gt;
&lt;P&gt;I also tried Segment in path, it still the same...&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled picture.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19654iBA430EFF4511CABB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled picture.png" alt="Untitled picture.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please help...&lt;/P&gt;</description>
    <pubDate>Mon, 16 May 2022 15:22:08 GMT</pubDate>
    <dc:creator>cecilia_cheng1</dc:creator>
    <dc:date>2022-05-16T15:22:08Z</dc:date>
    <item>
      <title>How to Extract the host values from the path?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/597932#M104339</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I am new to splunk. I've got trouble when I was trying to get host values from the path.&lt;/P&gt;
&lt;P&gt;The directory I set is&amp;nbsp;D:\14. splunk\SMT\. No matter what kind of extract function i was using: regex or segment, it doesn't work.&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;P&gt;The host name of the following file should be "PCXXXXX", but it still shows the default host name .&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture-2.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19653i84E786E3AE0882B3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture-2.PNG" alt="Capture-2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;However, I already set the host name with regex on path, but it doesn't work...&lt;/P&gt;
&lt;P&gt;I also tried Segment in path, it still the same...&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled picture.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19654iBA430EFF4511CABB/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled picture.png" alt="Untitled picture.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please help...&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 15:22:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/597932#M104339</guid>
      <dc:creator>cecilia_cheng1</dc:creator>
      <dc:date>2022-05-16T15:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the host values from the path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/597936#M104340</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245844"&gt;@cecilia_cheng1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you could use the host_segment=3 but anyway, the regex to take the value is&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;^\w+:(\\[^\\]+){2}\\(?&amp;lt;host&amp;gt;[^\\]+)&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/hPopwS/1" target="_blank"&gt;https://regex101.com/r/hPopwS/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 12:16:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/597936#M104340</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-16T12:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the host values from the path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/597939#M104341</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Really appreciated your reply,&amp;nbsp; I just tried your suggestion, but it still doesn't work... And I've tried the segment 3 before, not working...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":loudly_crying_face:"&gt;😭&lt;/span&gt;&lt;/P&gt;&lt;P&gt;BR.&lt;/P&gt;&lt;P&gt;Cecilia&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 12:40:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/597939#M104341</guid>
      <dc:creator>cecilia_cheng1</dc:creator>
      <dc:date>2022-05-16T12:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the host values from the path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/597940#M104342</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245844"&gt;@cecilia_cheng1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;P&gt;in your inputs.conf stanza&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[monitor://D:\*\SMT\*]
host_regex = ^\w+:(\\[^\\]+){2}\\([^\\]+)&lt;/LI-CODE&gt;&lt;P&gt;Otherwise, you could override the host value on Indexers or Heavy Forwarders in this way:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#props.conf
[your_sourcetype]
TRANSFORMS-hostFromSource=hostFromSource&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#transforms.conf
[hostFromSource]
SOURCE_KEY = MetaData:Source
REGEX=^\w+:(\\[^\\]+){2}\\([^\\]+)
FORMAT = $1
DEST_KEY= MetaData:Host&lt;/LI-CODE&gt;&lt;P&gt;for more infos see at&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Data/Setadefaulthostforaninput" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Data/Setadefaulthostforaninput&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 13:04:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/597940#M104342</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-16T13:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the host values from the path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/598047#M104347</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you for your supporting.&lt;/P&gt;&lt;P&gt;I moved the data to a new folder and reimported it with "host_segment" stanza and it worked...&lt;/P&gt;&lt;P&gt;The odd thing is, I deleted the original files and paths, but the previous imported files are still visible in the search. Maybe Splunk's data has memory or something, so the previous changes don't take effect and you need to create a new path?&lt;/P&gt;&lt;P&gt;BR.&lt;/P&gt;&lt;P&gt;Cecilia&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 08:03:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/598047#M104347</guid>
      <dc:creator>cecilia_cheng1</dc:creator>
      <dc:date>2022-05-17T08:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the host values from the path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/598050#M104348</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245844"&gt;@cecilia_cheng1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if you already indexed data, they remain in Splunk even if you deleted files!&lt;/P&gt;&lt;P&gt;If you want to delete them from Splunk, you have to use the delete command (with much muche attention!), but anyway, we're speaking of a logical deletion and not of a physical deletion.&lt;/P&gt;&lt;P&gt;If my answer solves your need, please accept it for the other people of Community.&lt;/P&gt;&lt;P&gt;See next time.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 08:10:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/598050#M104348</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-17T08:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Extract the host values from the path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/598246#M104373</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Yes, that's what I figure out, that the Splunk will "store" the data once indexing them. That's explain everything.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again~&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Cecilia&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 07:03:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-Extract-the-host-values-from-the-path/m-p/598246#M104373</guid>
      <dc:creator>cecilia_cheng1</dc:creator>
      <dc:date>2022-05-18T07:03:14Z</dc:date>
    </item>
  </channel>
</rss>

