<?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: Use regex to retrieve the source string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Use-regex-to-retrieve-the-source-string/m-p/150316#M42117</link>
    <description>&lt;P&gt;I found the solution. ..... The regex format is very different from javascript, .net.....&lt;/P&gt;

&lt;P&gt;Here's my answer.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=XXX| rex field=source "(\d+)(?=[\\\/](?.*)[\\\/]*$)"|table sss source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 Oct 2014 01:53:36 GMT</pubDate>
    <dc:creator>chrismok</dc:creator>
    <dc:date>2014-10-03T01:53:36Z</dc:date>
    <item>
      <title>Use regex to retrieve the source string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-regex-to-retrieve-the-source-string/m-p/150315#M42116</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;As I want to retrieve part of the source name and inner join to the other source. I would like to use the regex to get the source. However I am not sure how to write it&lt;/P&gt;

&lt;P&gt;Here the source name list&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;D:\\deploy\\logs\\uat\\20140929101121\\build1.log
//usr//bin//app1//log//dev//20140929100730//build2.log
//usr//bin//app1//log//dev//20140929100728//build1.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I would like to get the timestamp in the path.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;20140929101121
20140929100730
20140929100728
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The regex should be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (\d+)(?=[\\\/]{2}[^\\\/]*$)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I don't know how to implement to search query.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Chris&lt;/P&gt;</description>
      <pubDate>Fri, 03 Oct 2014 01:10:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-regex-to-retrieve-the-source-string/m-p/150315#M42116</guid>
      <dc:creator>chrismok</dc:creator>
      <dc:date>2014-10-03T01:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Use regex to retrieve the source string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-regex-to-retrieve-the-source-string/m-p/150316#M42117</link>
      <description>&lt;P&gt;I found the solution. ..... The regex format is very different from javascript, .net.....&lt;/P&gt;

&lt;P&gt;Here's my answer.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=XXX| rex field=source "(\d+)(?=[\\\/](?.*)[\\\/]*$)"|table sss source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Oct 2014 01:53:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-regex-to-retrieve-the-source-string/m-p/150316#M42117</guid>
      <dc:creator>chrismok</dc:creator>
      <dc:date>2014-10-03T01:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Use regex to retrieve the source string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-regex-to-retrieve-the-source-string/m-p/150317#M42118</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Need help with something similiar..Not able to generate the correct regex for this.&lt;BR /&gt;
Source files and the needed extractions are shown below.&lt;BR /&gt;
1)  file.1000.1.log            --Should return 1&lt;BR /&gt;
2)  file.1000.1.32.log      -- Should return 1&lt;BR /&gt;
3)  file.1000.2.log           -- Should return 2&lt;BR /&gt;
4)  file.1000.2.16.log      --Should return 2&lt;BR /&gt;
5)  file.1000.2.32.log      --Should return 2&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2016 15:32:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-regex-to-retrieve-the-source-string/m-p/150317#M42118</guid>
      <dc:creator>meenuvn</dc:creator>
      <dc:date>2016-05-16T15:32:00Z</dc:date>
    </item>
  </channel>
</rss>

