<?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: field extraction from source log path in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/658609#M227485</link>
    <description>&lt;LI-CODE lang="markup"&gt;| rex field=source "^([^\\\\]+\\\\){6}(?&amp;lt;node&amp;gt;[^\\\\]+)"&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 25 Sep 2023 14:50:22 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-09-25T14:50:22Z</dc:date>
    <item>
      <title>field extraction from source log path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/658607#M227483</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to extract the node name from the different GC source location:&lt;/P&gt;&lt;P&gt;I have below sample three source location and I am looking for rex that can extract node name as "node02, Node03 and "web39". My rex command is not working.&lt;/P&gt;&lt;P&gt;source= E:\total\int\ts1\Ddoss\node\node02\data\gc.log&lt;BR /&gt;source=E:\total\int\ts1\Ddoss\swxx\node03\data\gc.log&lt;BR /&gt;source=E:\total\int\ts1\Ddoss\web\web39\data\gc.log&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 14:44:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/658607#M227483</guid>
      <dc:creator>ravir_jbp</dc:creator>
      <dc:date>2023-09-25T14:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: field extraction from source log path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/658609#M227485</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex field=source "^([^\\\\]+\\\\){6}(?&amp;lt;node&amp;gt;[^\\\\]+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Sep 2023 14:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/658609#M227485</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-09-25T14:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: field extraction from source log path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/661392#M228350</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using above rex for these log source but not working:&lt;/P&gt;&lt;P&gt;For below 5 different log source I like to extract node number like node06, node03, node01&lt;/P&gt;&lt;P&gt;E:\view\int\t4\apch\node\node06\log\server.log&lt;BR /&gt;E:\view\int\t4\apch\node\node06\log\run.log&lt;BR /&gt;E:\view\int\t4\apch\node\node03\log\server.log&lt;BR /&gt;E:\view\int\t4\apch\node\node01\log\server.log&lt;BR /&gt;E:\view\int\t4\apch\node\node01\log\run.log&lt;/P&gt;&lt;P&gt;For below 3 log source I like to extract as core02, web37, core01&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;E:\view\int\t4\logs\core02-core.log&lt;BR /&gt;E:\view\int\t4\logs\web37-wfmws.log&lt;BR /&gt;E:\view\int\t4\logs\core01-core.log&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since both log format is different above solution you shared is not working. Please help&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 14:37:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/661392#M228350</guid>
      <dc:creator>ravir_jbp</dc:creator>
      <dc:date>2023-10-19T14:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: field extraction from source log path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/661508#M228353</link>
      <description>&lt;P&gt;Here is a runanywhere example showing it working&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="source
E:\view\int\t4\apch\node\node06\log\server.log
E:\view\int\t4\apch\node\node06\log\run.log
E:\view\int\t4\apch\node\node03\log\server.log
E:\view\int\t4\apch\node\node01\log\server.log
E:\view\int\t4\apch\node\node01\log\run.log
E:\view\int\t4\logs\core02-core.log
E:\view\int\t4\logs\web37-wfmws.log
E:\view\int\t4\logs\core01-core.log"
| rex field=source "^([^\\\\]+\\\\){5}(?&amp;lt;node&amp;gt;[^-]+)"
| rex field=source "^([^\\\\]+\\\\){6}(?&amp;lt;node&amp;gt;[^\\\\]+)"&lt;/LI-CODE&gt;&lt;P&gt;Note if these different formats for source are used in the same search then the order is significant, otherwise just use the relevant rex pertaining to the source name format&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 15:05:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/661508#M228353</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-10-19T15:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: field extraction from source log path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/663381#M228356</link>
      <description>&lt;P&gt;I would be cautious to anchor regex as closely as the data is regular. &amp;nbsp;Something like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=source "\\\t4\\\(apch\\\node|logs)\\\(?&amp;lt;node&amp;gt;[^-\\\\]+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This should give&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;node&lt;/TD&gt;&lt;TD&gt;source&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;node06&lt;/TD&gt;&lt;TD&gt;E:\view\int\t4\apch\node\node06\log\server.log&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;node06&lt;/TD&gt;&lt;TD&gt;E:\view\int\t4\apch\node\node06\log\run.log&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;node03&lt;/TD&gt;&lt;TD&gt;E:\view\int\t4\apch\node\node03\log\server.log&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;node01&lt;/TD&gt;&lt;TD&gt;E:\view\int\t4\apch\node\node01\log\server.log&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;node01&lt;/TD&gt;&lt;TD&gt;E:\view\int\t4\apch\node\node01\log\run.log&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;core02&lt;/TD&gt;&lt;TD&gt;E:\view\int\t4\logs\core02-core.log&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;web37&lt;/TD&gt;&lt;TD&gt;E:\view\int\t4\logs\web37-wfmws.log&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;core01&lt;/TD&gt;&lt;TD&gt;E:\view\int\t4\logs\core01-core.log&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;You can play with the emulation&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;offered and compare with real data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="source
E:\view\int\t4\apch\node\node06\log\server.log
E:\view\int\t4\apch\node\node06\log\run.log
E:\view\int\t4\apch\node\node03\log\server.log
E:\view\int\t4\apch\node\node01\log\server.log
E:\view\int\t4\apch\node\node01\log\run.log
E:\view\int\t4\logs\core02-core.log
E:\view\int\t4\logs\web37-wfmws.log
E:\view\int\t4\logs\core01-core.log"
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 16:11:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/field-extraction-from-source-log-path/m-p/663381#M228356</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-19T16:11:39Z</dc:date>
    </item>
  </channel>
</rss>

