<?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 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566809#M197517</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;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all, Thank you both!&lt;/P&gt;&lt;P&gt;I forgot that in addition to the full date, this field contains the hour and minutes. for example,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;this_is_an_example_09_13_2021_03_45&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How should I change the rex command?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Sep 2021 08:31:17 GMT</pubDate>
    <dc:creator>alonKri</dc:creator>
    <dc:date>2021-09-13T08:31:17Z</dc:date>
    <item>
      <title>Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566798#M197510</link>
      <description>&lt;P&gt;Hi Splunk team, I would like to receive your dedicated help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a string field, the&amp;nbsp;field's structure is &lt;STRONG&gt;name_timestamp&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The name contains underscores between words, after the name, there is another&amp;nbsp;underscore. Finally, there is a full date. for example: &lt;STRONG&gt;this_is_an_example_09_13_2021&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;My goal is to extract the name from this field. for this example, I would like to receive&amp;nbsp;&lt;STRONG&gt;this_is_an_example.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Is it possible?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 08:00:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566798#M197510</guid>
      <dc:creator>alonKri</dc:creator>
      <dc:date>2021-09-13T08:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566801#M197512</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex "(?&amp;lt;words&amp;gt;[a-zA-Z_]+)_\d{2}_\d{2}_\d{4}"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 13 Sep 2021 08:12:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566801#M197512</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-13T08:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566802#M197513</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;yes it is. You could try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;....
| rex field=name_timestamp max_match=0 "(?&amp;lt;file_name&amp;gt;.*)_\d{1,2}_\d{1,2}_\d{2,4}$"&lt;/LI-CODE&gt;&lt;P&gt;r. Ismo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 08:13:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566802#M197513</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-09-13T08:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566809#M197517</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;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214410"&gt;@isoutamo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all, Thank you both!&lt;/P&gt;&lt;P&gt;I forgot that in addition to the full date, this field contains the hour and minutes. for example,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;this_is_an_example_09_13_2021_03_45&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How should I change the rex command?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 08:31:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566809#M197517</guid>
      <dc:creator>alonKri</dc:creator>
      <dc:date>2021-09-13T08:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566810#M197518</link>
      <description>&lt;P&gt;Since you are not extracting the time (or at least that wasn't the requirement), you will probably find that the current anchor pattern will suffice - if you do need to extend it add _\d{2}_\d{2}&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 08:37:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566810#M197518</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-13T08:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566812#M197519</link>
      <description>&lt;P&gt;Where should I put it?&lt;/P&gt;&lt;P&gt;for example, this is the received output.&lt;/P&gt;&lt;P&gt;Note: The name may contain numbers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alonKri_0-1631523466792.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15962i27C0D68037AABF3A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="alonKri_0-1631523466792.png" alt="alonKri_0-1631523466792.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 08:57:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566812#M197519</guid>
      <dc:creator>alonKri</dc:creator>
      <dc:date>2021-09-13T08:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566816#M197521</link>
      <description>&lt;P&gt;"(?&amp;lt;test&amp;gt;.*)" basically match everything on this field. When we are adding "_\d{4}_\d{2}_\d{2}_\d{2}_\d{2}$" we are requiring that at the end of this string there are _ + 4 digits + _ + 2 digits ... etc. and everything before that is put on test field. So based on your string just add those _\d{4} and&amp;nbsp;_\d{2} to correct places. And if those days, hours, minutes and seconds can be only in one (1) digit long then use _\d{1,2} to catch also those.&lt;/P&gt;&lt;P&gt;So based on your screenshot you should use e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rex field=test max_match=0 "(?&amp;lt;test&amp;gt;.*)_\d{4}_\d{2}_\d{2}_\d{2}_\d{2}$" &lt;/LI-CODE&gt;&lt;P&gt;If you are using name test on field and in capture group then you are replacing the content of this field with file name instead of creating a new field for file_name. So if you need the original file name later on then it's better to use something else than test as a capture group name.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Mon, 13 Sep 2021 09:13:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566816#M197521</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-09-13T09:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566824#M197527</link>
      <description>&lt;P&gt;Thanks so much! It's working&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&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;</description>
      <pubDate>Mon, 13 Sep 2021 10:41:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction/m-p/566824#M197527</guid>
      <dc:creator>alonKri</dc:creator>
      <dc:date>2021-09-13T10:41:07Z</dc:date>
    </item>
  </channel>
</rss>

