<?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 via rex a list of hostnames from a block of text in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-via-rex-a-list-of-hostnames-from-a-block-of-text/m-p/429543#M170638</link>
    <description>&lt;P&gt;the "block of text" takes the following form.&lt;/P&gt;

&lt;P&gt;Please retire the following nodes(s):&lt;BR /&gt;
hostname1 node_id: "text I dont need"&lt;BR /&gt;
hostname2 node_id: "text I dont need"&lt;BR /&gt;
hostname3 node_id: "text I dont need"&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
hostnameN node_id: "text I dont need"&lt;BR /&gt;
Property: "text I dont need"&lt;BR /&gt;
~~~&lt;/P&gt;

&lt;P&gt;and what I would like is a list&lt;BR /&gt;
hostname1&lt;BR /&gt;
hostname2&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
hostnameN&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 00:58:26 GMT</pubDate>
    <dc:creator>swangertyler</dc:creator>
    <dc:date>2020-09-30T00:58:26Z</dc:date>
    <item>
      <title>Extract via rex a list of hostnames from a block of text</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-via-rex-a-list-of-hostnames-from-a-block-of-text/m-p/429542#M170637</link>
      <description>&lt;P&gt;I am trying to get a list of hostnames from a block of text via rex. I know I want the first string of every newline after the string "Please retire the following nodes(s):"&lt;/P&gt;

&lt;P&gt;I couldnt solve for that, so I figured just getting all of the text after that string was "close enough" for now. I cannot get that to work right either.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=description "(?mis)Please retire the following nodes\(s\):\n(?P&amp;lt;hostname&amp;gt;.*).\n"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That doesn't return me anything. I have tried using online testers, and that regex seems to pass. What am I missing?&lt;/P&gt;

&lt;P&gt;Plus, if anyone wants to flex their regex-fu and help me just get the first string on every new line vs. solving my "adjusted" problem, that is cool with me too.&lt;/P&gt;

&lt;P&gt;Frankly, any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 20:59:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-via-rex-a-list-of-hostnames-from-a-block-of-text/m-p/429542#M170637</guid>
      <dc:creator>swangertyler</dc:creator>
      <dc:date>2019-06-19T20:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Extract via rex a list of hostnames from a block of text</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-via-rex-a-list-of-hostnames-from-a-block-of-text/m-p/429543#M170638</link>
      <description>&lt;P&gt;the "block of text" takes the following form.&lt;/P&gt;

&lt;P&gt;Please retire the following nodes(s):&lt;BR /&gt;
hostname1 node_id: "text I dont need"&lt;BR /&gt;
hostname2 node_id: "text I dont need"&lt;BR /&gt;
hostname3 node_id: "text I dont need"&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
hostnameN node_id: "text I dont need"&lt;BR /&gt;
Property: "text I dont need"&lt;BR /&gt;
~~~&lt;/P&gt;

&lt;P&gt;and what I would like is a list&lt;BR /&gt;
hostname1&lt;BR /&gt;
hostname2&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
hostnameN&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-via-rex-a-list-of-hostnames-from-a-block-of-text/m-p/429543#M170638</guid>
      <dc:creator>swangertyler</dc:creator>
      <dc:date>2020-09-30T00:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract via rex a list of hostnames from a block of text</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-via-rex-a-list-of-hostnames-from-a-block-of-text/m-p/429544#M170639</link>
      <description>&lt;P&gt;hi swangertyler,&lt;/P&gt;

&lt;P&gt;based on the provided examples give this a try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval message="Please retire the following nodes(s):
hostname1 node_id: \"text I dont need\"
    hostname2 node_id: \"text I dont need\"
    hostname3 node_id: \"text I dont need\"
    .
.
.
hostnameN node_id: \"text I dont need\"
    Property: \"text I dont need\"" 
| rex field=message max_match=0 "(?&amp;lt;hostname&amp;gt;\w+)\snode_id"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 23:35:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-via-rex-a-list-of-hostnames-from-a-block-of-text/m-p/429544#M170639</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-06-19T23:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract via rex a list of hostnames from a block of text</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-via-rex-a-list-of-hostnames-from-a-block-of-text/m-p/429545#M170640</link>
      <description>&lt;P&gt;MuS. Nailed it. I had to tweak it minorly to get it to work with my real data since my "hostnameM" takes the form of a fully qualified domain name.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults 
 | eval message="Please retire the following nodes(s):
 fully.qualified.domain1 node_id: \"text I dont need\"
     fully.qualified.domain2 node_id: \"text I dont need\"
     fully.qualified.domain3 node_id: \"text I dont need\"
     .
 .
 .
 fully.qualified.domainN node_id: \"text I dont need\"
     Property: \"text I dont need\"" 
 | rex field=message max_match=0 "(?&amp;lt;hostname&amp;gt;.*)\snode_id"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jun 2019 14:46:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-via-rex-a-list-of-hostnames-from-a-block-of-text/m-p/429545#M170640</guid>
      <dc:creator>swangertyler</dc:creator>
      <dc:date>2019-06-20T14:46:37Z</dc:date>
    </item>
  </channel>
</rss>

