<?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: Extract multiple values from a single existing field, using regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442710#M125653</link>
    <description>&lt;P&gt;I'm trying to extract like you sent in the first link.&lt;BR /&gt;
Thanks I'll try it again &lt;/P&gt;</description>
    <pubDate>Wed, 08 May 2019 11:27:38 GMT</pubDate>
    <dc:creator>hketer</dc:creator>
    <dc:date>2019-05-08T11:27:38Z</dc:date>
    <item>
      <title>Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442705#M125648</link>
      <description>&lt;P&gt;Hey,&lt;BR /&gt;
I have this event.&lt;BR /&gt;
as you can see there is field named cs1.&lt;BR /&gt;
I need to create new field lets say cs_1 and extract  the values &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;FTP - using unsecured file transfer&lt;/LI&gt;
&lt;LI&gt;FTP plaintext user &amp;amp; password&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;output for cs_1 will be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;                 cs_1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;H2&gt;FTP - using unsecured file transfer&lt;/H2&gt;

&lt;H2&gt;FTP plaintext user &amp;amp; password&lt;/H2&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7004i34CF58D8A99C7751/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;please assist:)&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 11:03:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442705#M125648</guid>
      <dc:creator>hketer</dc:creator>
      <dc:date>2019-05-08T11:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442706#M125649</link>
      <description>&lt;P&gt;any chance you can paste the sample data (rather than image)&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 11:08:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442706#M125649</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2019-05-08T11:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442707#M125650</link>
      <description>&lt;P&gt;04-29-2019  11:03:53    Local7.Debug    CEF:0||6.5.7|A12755045326585428785|black policy|1|app=ftp cnt=2 cs1=['5050447193422847;;FTP - using unsecured file transfer;;;;;;', '2742510939747842;;FTP plaintext user &amp;amp; password;;;;;;'] cs1Label=reason cs2=['server_to_client', 'client_to_server'] cs2Label=direction deviceExternalId=Sensor dmac= dpt=3592 dst= end=1556525018000 proto=TCP smac= spt=21 src= start=1556525018000&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:23:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442707#M125650</guid>
      <dc:creator>hketer</dc:creator>
      <dc:date>2020-09-30T00:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442708#M125651</link>
      <description>&lt;P&gt;Please try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults
|eval my_raw="04-29-2019 11:03:53 Local7.Debug xx CEF:0 [somehost] 6.5.7|a12345|black plicy|1|app=ftp cs1=['50512345;;FTP - using unsecured file transfer;;;;;;','272510;;FTP plaintext user &amp;amp; password;;;;;;'] cs1Label=Reason ]"
| rex field=my_raw "\[\'.+?\;\;(?&amp;lt;cs_1_ftpA&amp;gt;FTP[^\;]+).+?(?&amp;lt;cs_1_ftpB&amp;gt;FTP[^\;]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Regex101 demo =&amp;gt; &lt;A href="https://regex101.com/r/azZv9k/1/"&gt;https://regex101.com/r/azZv9k/1/&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;Also if you need to club the messages into a single Key&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults
|eval my_raw="04-29-2019 11:03:53 Local7.Debug xx CEF:0 [somehost] 6.5.7|a12345|black plicy|1|app=ftp cs1=['50512345;;FTP - using unsecured file transfer;;;;;;','272510;;FTP plaintext user &amp;amp; password;;;;;;'] cs1Label=Reason ]"
| rex field=my_raw "\[\'.+?\;\;(?&amp;lt;cs_1_ftpA&amp;gt;FTP[^\;]+).+?(?&amp;lt;cs_1_ftpB&amp;gt;FTP[^\;]+)"
| eval cs1 = cs_1_ftpA + ";" + cs_1_ftpB |makemv delim=";" cs1| table cs1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;cheers&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 11:19:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442708#M125651</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2019-05-08T11:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442709#M125652</link>
      <description>&lt;P&gt;Hi @hketer,&lt;/P&gt;

&lt;P&gt;Extracting a field from another can be done using props and transforms and shown here : &lt;A href="https://answers.splunk.com/answers/493083/how-to-transformregex-on-already-extracted-field-w.html"&gt;https://answers.splunk.com/answers/493083/how-to-transformregex-on-already-extracted-field-w.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If you don't want to go through this hassle you can use a calculated field which is easier to setup as shown in this answer here : &lt;A href="https://answers.splunk.com/answers/177878/how-to-extract-a-field-from-within-the-value-of-an.html"&gt;https://answers.splunk.com/answers/177878/how-to-extract-a-field-from-within-the-value-of-an.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Let me know which part of cs1 you want to extract and I can help you with the regexp if needed.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 11:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442709#M125652</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-08T11:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442710#M125653</link>
      <description>&lt;P&gt;I'm trying to extract like you sent in the first link.&lt;BR /&gt;
Thanks I'll try it again &lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 11:27:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442710#M125653</guid>
      <dc:creator>hketer</dc:creator>
      <dc:date>2019-05-08T11:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442711#M125654</link>
      <description>&lt;P&gt;Thank you! I appreciate it!!&lt;/P&gt;

&lt;P&gt;I want it to be separate values in the same field, and right now both of them is 1 value &lt;/P&gt;

&lt;H2&gt;cs1&lt;/H2&gt;

&lt;P&gt;FTP - using unsecured file transfer&lt;/P&gt;

&lt;H2&gt;FTP plaintext user &amp;amp; password&lt;/H2&gt;

&lt;P&gt;FTP - using unsecured file transfer&lt;BR /&gt;
FTP plaintext user &amp;amp; password&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 11:31:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442711#M125654</guid>
      <dc:creator>hketer</dc:creator>
      <dc:date>2019-05-08T11:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442712#M125655</link>
      <description>&lt;P&gt;@hketer, how you want it to be separate values? Comma limited? you can just play around with &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval cs1 = cs_1_ftpA + ";" + cs_1_ftpB 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to fit your purpose&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 11:41:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442712#M125655</guid>
      <dc:creator>koshyk</dc:creator>
      <dc:date>2019-05-08T11:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442713#M125656</link>
      <description>&lt;P&gt;Awesome ! Let me know if you hit a stonewall with the config files, happy to help out and feel free to accept the answer if it helped !&lt;BR /&gt;
Cheers&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 11:46:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442713#M125656</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-08T11:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442714#M125657</link>
      <description>&lt;P&gt;What about using  &lt;CODE&gt;max_match=0&lt;/CODE&gt; in your  &lt;CODE&gt;rex&lt;/CODE&gt; ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults
|eval my_raw="04-29-2019 11:03:53 Local7.Debug xx CEF:0 [somehost] 6.5.7|a12345|black plicy|1|app=ftp cs1=['50512345;;FTP - using unsecured file transfer;;;;;;','272510;;FTP plaintext user &amp;amp; password;;;;;;'] cs1Label=Reason ]"
 | rex max_match=0 field=my_raw ";(?&amp;lt;cs_1&amp;gt;FTP[^;]+)"
 | table cs_1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gives me a nice multivalue Field for  &lt;CODE&gt;cs_1&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 12:27:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442714#M125657</guid>
      <dc:creator>damann</dc:creator>
      <dc:date>2019-05-08T12:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442715#M125658</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Thanks for the answer!&lt;BR /&gt;
I've tried it and yet its not the result I'm looking for.&lt;/P&gt;

&lt;P&gt;the 2 FTP lines are in the same cell and I need it to be separate&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 14:52:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442715#M125658</guid>
      <dc:creator>hketer</dc:creator>
      <dc:date>2019-05-10T14:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442716#M125659</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | rex max_match=0 field=my_raw ";(?&amp;lt;cs_1&amp;gt;FTP[^;]+)" 
| table cs_1
| mvexpand cs_1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 May 2019 20:07:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442716#M125659</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-10T20:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442717#M125660</link>
      <description>&lt;P&gt;Hi! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Thank you for your help! I appreciate it!!&lt;/P&gt;

&lt;P&gt;I'll explain myself again&lt;/P&gt;

&lt;P&gt;I have 4 different events that contain the field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cs1=['5050447193422847;;FTP - using unsecured file transfer;;;;;;', '2742510939747842;;FTP plaintext user &amp;amp; password;;;;;;']
cs1=['4163302463635179;;SMB2 login failure;;;;;;']
cs1=['4277463150217252;;Stop;;;;;;']
cs1=['5050447193422847;;FTP - using unsecured file transfer;;;;;;']
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;as you can see in one of the events I have 2 FTP messages in the same field.&lt;BR /&gt;
I need to extract (not in search) the values to a new field, for example, &lt;CODE&gt;cs_1&lt;/CODE&gt;&lt;BR /&gt;
the field now will contain 4 different values &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cs1=FTP - using unsecured file transfer
cs1=FTP plaintext user &amp;amp; password
cs1=SMB2 login failure
cs1=Stop
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cs1=FTP - using unsecured file transfer
cs1=FTP - using unsecured file transfer , FTP plaintext user &amp;amp; password
cs1=SMB2 login failure
cs1=Stop
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;haven't decided yet but if someone can help me with one of them it would be amazing!!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Thank YOU!&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 08:00:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442717#M125660</guid>
      <dc:creator>hketer</dc:creator>
      <dc:date>2019-05-13T08:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extract multiple values from a single existing field, using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442718#M125661</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="cs1=['5050447193422847;;FTP - using unsecured file transfer;;;;;;', '2742510939747842;;FTP plaintext user &amp;amp; password;;;;;;']:::cs1=['4163302463635179;;SMB2 login failure;;;;;;']:::cs1=['4277463150217252;;Stop;;;;;;']:::cs1=['5050447193422847;;FTP - using unsecured file transfer;;;;;;']"
| makemv delim=":::" raw
| mvexpand raw
| rename raw AS _raw
| kv
| table cs1

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| rex field=cs1 mode=sed "s/^\[// s/\]$//"
| makemv delim="', '" cs1
| rex field=cs1 mode=sed "s/^'// s/'$//"
| rex field=cs1 "^(?:[^;]*;){2}(?&amp;lt;cs_1&amp;gt;[^;]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 May 2019 23:42:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-multiple-values-from-a-single-existing-field-using-regex/m-p/442718#M125661</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-05-13T23:42:10Z</dc:date>
    </item>
  </channel>
</rss>

