<?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 extract multiple strings from multiple lines into 1 field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-multiple-strings-from-multiple-lines-into-1-field/m-p/168225#M47953</link>
    <description>&lt;P&gt;add a &lt;CODE&gt;| sort network-srcinfo&lt;/CODE&gt; at the end &lt;/P&gt;</description>
    <pubDate>Thu, 05 Mar 2015 09:20:23 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2015-03-05T09:20:23Z</dc:date>
    <item>
      <title>how to extract multiple strings from multiple lines into 1 field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-multiple-strings-from-multiple-lines-into-1-field/m-p/168222#M47950</link>
      <description>&lt;P&gt;I have a logline that is extracted in multiple fields already. 1 of those fields contain multiple strings on different lines.&lt;BR /&gt;
I would like to extract certain strings from these lines, and add them to a single field.&lt;/P&gt;

&lt;P&gt;example log:&lt;/P&gt;

&lt;P&gt;source=10.0.0.1&lt;BR /&gt;
destination=10.0.0.2&lt;BR /&gt;
action=deny&lt;BR /&gt;
extra=rule number 1&lt;BR /&gt;
xlated_source:192.168.0.1&lt;BR /&gt;
xlated_destination:10.0.0.2&lt;BR /&gt;
source_info:the source is part of group /source/network/LAN&lt;BR /&gt;
source_info:the source is part of group /source/network/LAN-Tulsa&lt;BR /&gt;
source_info:the source is part of group /source/network/LAN-printers&lt;BR /&gt;
dest_info:the destination is part of group /destination/network/LAN&lt;BR /&gt;
dest_info:the destination is part of group /destination/network/LAN-DC&lt;/P&gt;

&lt;P&gt;as a result I would like to have the following new fields extracted from the "extra" field:&lt;BR /&gt;
network-srcinfo=LAN,LAN-Tulsa,LAN-printers&lt;BR /&gt;
network-dstinfo=LAN,LAN-DC&lt;/P&gt;

&lt;P&gt;when I do a:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "/source/network/(?\.*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I only get:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;network-srcinfo=LAN
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm quite new to splunk, and I can't seem to find an answer to this.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:06:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-multiple-strings-from-multiple-lines-into-1-field/m-p/168222#M47950</guid>
      <dc:creator>mikegdlw</dc:creator>
      <dc:date>2020-09-28T19:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract multiple strings from multiple lines into 1 field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-multiple-strings-from-multiple-lines-into-1-field/m-p/168223#M47951</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex max_match=0 field=_raw "\/source\/network\/(?&amp;lt;network-srcinfo&amp;gt;.*)" | table network-srcinfo
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Mar 2015 12:01:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-multiple-strings-from-multiple-lines-into-1-field/m-p/168223#M47951</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-03-04T12:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract multiple strings from multiple lines into 1 field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-multiple-strings-from-multiple-lines-into-1-field/m-p/168224#M47952</link>
      <description>&lt;P&gt;Thank you! that fixed my issue.&lt;/P&gt;

&lt;P&gt;Of course, now a new one popped up. It seems that within the logs, things are not as consistent as I thought.&lt;BR /&gt;
so it can indeed show up as:&lt;BR /&gt;
source_info:the source is part of group /source/network/LAN&lt;BR /&gt;
source_info:the source is part of group /source/network/LAN-Tulsa&lt;BR /&gt;
source_info:the source is part of group /source/network/LAN-printers&lt;/P&gt;

&lt;P&gt;but also in other combinations:&lt;BR /&gt;
source_info:the source is part of group /source/network/LAN-Tulsa&lt;BR /&gt;
source_info:the source is part of group /source/network/LAN&lt;BR /&gt;
source_info:the source is part of group /source/network/LAN-printers&lt;/P&gt;

&lt;P&gt;is there a way to do an alphabetical sort within the network-srcinfo field? &lt;BR /&gt;
otherwise the results would be that "LAN, LAN-Tulsa, LAN-printers" is seen as different than "LAN-Tulsa, LAN, LAN-printers" while in essence, this is not the case&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:07:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-multiple-strings-from-multiple-lines-into-1-field/m-p/168224#M47952</guid>
      <dc:creator>mikegdlw</dc:creator>
      <dc:date>2020-09-28T19:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract multiple strings from multiple lines into 1 field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-extract-multiple-strings-from-multiple-lines-into-1-field/m-p/168225#M47953</link>
      <description>&lt;P&gt;add a &lt;CODE&gt;| sort network-srcinfo&lt;/CODE&gt; at the end &lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2015 09:20:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-extract-multiple-strings-from-multiple-lines-into-1-field/m-p/168225#M47953</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-03-05T09:20:23Z</dc:date>
    </item>
  </channel>
</rss>

