<?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: How to create a regex for a log file which contains multiple values throughout the log which required same field nam in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624502#M217112</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;really confused how to place this in the query&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;One way to help others help you unconfuse you is to illustrate the SPL you have at hand (simplify and anonymize as needed), then explain what confuses you, what error you get, or why the result is not what you wanted.&lt;/P&gt;&lt;P&gt;I already explained how I test my sample codes based on your sample data and description of your requirements. &amp;nbsp;I assume that you know where the search window is. &amp;nbsp;Just paste data emulation code above the manipulation code, and you can review the results. &amp;nbsp;Like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-12-15 at 10.08.30 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23052i113A6F6BD8B46BE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-12-15 at 10.08.30 PM.png" alt="Screen Shot 2022-12-15 at 10.08.30 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(In this example, I used the shorted code.) &amp;nbsp;Does this look like what you need? &amp;nbsp;Then, just replace the data emulation part with your own event search.&lt;/P&gt;&lt;P&gt;Hope this helps. &lt;/P&gt;</description>
    <pubDate>Fri, 16 Dec 2022 06:18:52 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2022-12-16T06:18:52Z</dc:date>
    <item>
      <title>How to create a regex for a log file which contains multiple values throughout the log which required same field name?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624204#M217021</link>
      <description>&lt;P&gt;Hello Team,&lt;BR /&gt;&lt;BR /&gt;This is the first time I am posting a question and hope that I have explained it thoroughly.&lt;/P&gt;
&lt;P&gt;I am trying to create a regex for a log file which contains multiple values throughout the log which required same field name. but splunk does not allows to use same field name again.&lt;/P&gt;
&lt;P&gt;Here is the sample log:&lt;/P&gt;
&lt;P&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;BR /&gt;&lt;BR /&gt;Note: Text values are 4 char and Number contains 10 digits.&lt;BR /&gt;&lt;BR /&gt;How can I move forward to achieve a field extraction and format like this?&lt;BR /&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;BR /&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;BR /&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;BR /&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;BR /&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;BR /&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;BR /&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;BR /&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;BR /&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank You in Advance&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 15:17:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624204#M217021</guid>
      <dc:creator>mssoni</dc:creator>
      <dc:date>2022-12-14T15:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex for a log file which contains multiple values throughout the log which required same field nam</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624273#M217048</link>
      <description>&lt;P&gt;I am not sure what you mean by "Splunk does not allow to use the same field name again." (This is SPL, of course anything is possible®&lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;)&lt;/P&gt;&lt;P&gt;Because your field values are separated by a known, fixed string "/TXT1/TXT2", a literal solution would be&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval samefield = split(_raw, "/TXT1/TXT2")
| eval samefield = mvfilter(len(samefield) != 0)
| eval samefield = mvmap(samefield, "/TXT1/TXT2" . samefield)&lt;/LI-CODE&gt;&lt;P&gt;This is an emulation I used to test the above; you can play with it and compare with real data&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw  = "/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9"
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;There can be several variants based on fixed text values.&lt;/P&gt;&lt;P&gt;If you want to relax the condition that the text portion is known and fixed, you can use the text and number characteristics you described,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex max_match=0 "(?&amp;lt;samefield&amp;gt;(/\w{4}){2}(/d{3}){9})"&lt;/LI-CODE&gt;&lt;P&gt;You can even generalize this to only require a total of 11 path segments:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex max_match=0 "(?&amp;lt;samefield&amp;gt;(/[^\/]+){11})"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 18:44:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624273#M217048</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-12-14T18:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex for a log file which contains multiple values throughout the log which required same field nam</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624303#M217060</link>
      <description>&lt;P&gt;the provided sample is a single log and is not separated by fields, but I want to implement fields with the help of regex in this format.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9
/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9
/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9
/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9
/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9
/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9
/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9
/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9
/TXT1/TXT2/NMBR1/NMBR2/NMBR3/NMBR4/NMBR5/NMBR6/NMBR7/NMBR8/NMBR9&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 03:49:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624303#M217060</guid>
      <dc:creator>mssoni</dc:creator>
      <dc:date>2022-12-15T03:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex for a log file which contains multiple values throughout the log which required same field nam</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624306#M217061</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252153"&gt;@mssoni&lt;/a&gt;&amp;nbsp;Have you tried my code? &amp;nbsp;Yes, I do understand that's one string and that's what I emulated: One very long string.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 05:40:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624306#M217061</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-12-15T05:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex for a log file which contains multiple values throughout the log which required same field nam</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624485#M217107</link>
      <description>&lt;P&gt;Not yet, I am really confused how to place this in the query, this is the first time I am working on its front end,&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 23:58:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624485#M217107</guid>
      <dc:creator>mssoni</dc:creator>
      <dc:date>2022-12-15T23:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a regex for a log file which contains multiple values throughout the log which required same field nam</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624502#M217112</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;really confused how to place this in the query&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;One way to help others help you unconfuse you is to illustrate the SPL you have at hand (simplify and anonymize as needed), then explain what confuses you, what error you get, or why the result is not what you wanted.&lt;/P&gt;&lt;P&gt;I already explained how I test my sample codes based on your sample data and description of your requirements. &amp;nbsp;I assume that you know where the search window is. &amp;nbsp;Just paste data emulation code above the manipulation code, and you can review the results. &amp;nbsp;Like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-12-15 at 10.08.30 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23052i113A6F6BD8B46BE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2022-12-15 at 10.08.30 PM.png" alt="Screen Shot 2022-12-15 at 10.08.30 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;(In this example, I used the shorted code.) &amp;nbsp;Does this look like what you need? &amp;nbsp;Then, just replace the data emulation part with your own event search.&lt;/P&gt;&lt;P&gt;Hope this helps. &lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 06:18:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-regex-for-a-log-file-which-contains-multiple/m-p/624502#M217112</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-12-16T06:18:52Z</dc:date>
    </item>
  </channel>
</rss>

