<?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 do I edit my regex to capture the shortname from a mix of FQDN and shortname host field entries? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regex-to-capture-the-shortname-from-a-mix-of/m-p/241344#M71768</link>
    <description>&lt;P&gt;It does! Kudo's for you, my friend!&lt;/P&gt;</description>
    <pubDate>Thu, 19 Nov 2015 21:28:20 GMT</pubDate>
    <dc:creator>renems</dc:creator>
    <dc:date>2015-11-19T21:28:20Z</dc:date>
    <item>
      <title>How do I edit my regex to capture the shortname from a mix of FQDN and shortname host field entries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regex-to-capture-the-shortname-from-a-mix-of/m-p/241342#M71766</link>
      <description>&lt;P&gt;I'm trying to create a new field based on the host field. The new field (hostname) should only contain the shortname. The host field is currently a mix of fqdn and shortnames:&lt;/P&gt;

&lt;P&gt;server1.linux.splunk.co.uk&lt;BR /&gt;
server2.linux.splunk.co.uk&lt;BR /&gt;
server3&lt;BR /&gt;
server4.linux.splunk.co.uk&lt;/P&gt;

&lt;P&gt;So far, this comes close to what I'm trying to achieve:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=host "(?P&amp;lt;hostname&amp;gt;[^ ]+?)\."
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Works great for all entries that actually do have a dot (.) in the text (number1, 2, 4). The ones without a dot (.) return blank. How do I also include the ones that don't need modification at all? (number 3)&lt;/P&gt;

&lt;P&gt;Any help greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 21:15:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regex-to-capture-the-shortname-from-a-mix-of/m-p/241342#M71766</guid>
      <dc:creator>renems</dc:creator>
      <dc:date>2015-11-19T21:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my regex to capture the shortname from a mix of FQDN and shortname host field entries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regex-to-capture-the-shortname-from-a-mix-of/m-p/241343#M71767</link>
      <description>&lt;P&gt;It's too greedy to put against just a block of text, but as long as the field is sanitary, this should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?P&amp;lt;hostname&amp;gt;[^.]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Nov 2015 21:23:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regex-to-capture-the-shortname-from-a-mix-of/m-p/241343#M71767</guid>
      <dc:creator>ltrand</dc:creator>
      <dc:date>2015-11-19T21:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my regex to capture the shortname from a mix of FQDN and shortname host field entries?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regex-to-capture-the-shortname-from-a-mix-of/m-p/241344#M71768</link>
      <description>&lt;P&gt;It does! Kudo's for you, my friend!&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 21:28:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-regex-to-capture-the-shortname-from-a-mix-of/m-p/241344#M71768</guid>
      <dc:creator>renems</dc:creator>
      <dc:date>2015-11-19T21:28:20Z</dc:date>
    </item>
  </channel>
</rss>

