<?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 get the hostname from the logs? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-hostname-from-the-logs/m-p/327320#M97469</link>
    <description>&lt;P&gt;Hi kiran331, You'll have to added a transform specification to the props config on the source or sourcetype. The transform could have a REGEX set to something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mail\.text\.([^\.]+\.[^\.])\.iphmx\.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Taking the config from another answer: &lt;A href="https://answers.splunk.com/answers/91933/can-you-override-host-for-an-input.html"&gt;https://answers.splunk.com/answers/91933/can-you-override-host-for-an-input.html&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#props
[source::mysource]
TRANSFORMS-ho=hostoverride

#transforms
[hostoverride]
DEST_KEY = MetaData:Host
REGEX = mail\.text\.([^\.]+\.[^\.])\.iphmx\.com
FORMAT = host::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You might need to adjust the source specification in props (your source probably isn't named "mysource"), and the regex might need adjusting as well to be more generic depending if you have different patterns for the hostnames in the source.&lt;/P&gt;

&lt;P&gt;This config will need to be set on the indexer, or whatever splunk instance does the processing pipeline on the events. &lt;/P&gt;

&lt;P&gt;Please let me know if this answers your question! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Apr 2017 16:09:08 GMT</pubDate>
    <dc:creator>muebel</dc:creator>
    <dc:date>2017-04-13T16:09:08Z</dc:date>
    <item>
      <title>How to get the hostname from the logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-hostname-from-the-logs/m-p/327319#M97468</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have the syslogs coming from 4 consoles in to single path, how to extract the hostnames in inputs.conf file?&lt;/P&gt;

&lt;P&gt;log names;&lt;/P&gt;

&lt;P&gt;&lt;A href="mailto:mail.text.esa1.abc.iphmx.com.@20170413T093916.s"&gt;mail.text.esa1.abc.iphmx.com.@20170413T093916.s&lt;/A&gt;&lt;BR /&gt;
&lt;A href="mailto:mail.text.esa2.abc.iphmx.com.@20170413T093916.s"&gt;mail.text.esa2.abc.iphmx.com.@20170413T093916.s&lt;/A&gt;&lt;BR /&gt;
&lt;A href="mailto:mail.text.esa3.abc.iphmx.com.@20170413T093916.s"&gt;mail.text.esa3.abc.iphmx.com.@20170413T093916.s&lt;/A&gt;&lt;BR /&gt;
&lt;A href="mailto:mail.text.esa4.abc.iphmx.com.@20170413T093916.s"&gt;mail.text.esa4.abc.iphmx.com.@20170413T093916.s&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;required hostnames:&lt;BR /&gt;
esa1.abc&lt;BR /&gt;
esa2.abc&lt;BR /&gt;
esa3.abc&lt;BR /&gt;
esa4.abc&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 15:10:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-hostname-from-the-logs/m-p/327319#M97468</guid>
      <dc:creator>kiran331</dc:creator>
      <dc:date>2017-04-13T15:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the hostname from the logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-hostname-from-the-logs/m-p/327320#M97469</link>
      <description>&lt;P&gt;Hi kiran331, You'll have to added a transform specification to the props config on the source or sourcetype. The transform could have a REGEX set to something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mail\.text\.([^\.]+\.[^\.])\.iphmx\.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Taking the config from another answer: &lt;A href="https://answers.splunk.com/answers/91933/can-you-override-host-for-an-input.html"&gt;https://answers.splunk.com/answers/91933/can-you-override-host-for-an-input.html&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#props
[source::mysource]
TRANSFORMS-ho=hostoverride

#transforms
[hostoverride]
DEST_KEY = MetaData:Host
REGEX = mail\.text\.([^\.]+\.[^\.])\.iphmx\.com
FORMAT = host::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You might need to adjust the source specification in props (your source probably isn't named "mysource"), and the regex might need adjusting as well to be more generic depending if you have different patterns for the hostnames in the source.&lt;/P&gt;

&lt;P&gt;This config will need to be set on the indexer, or whatever splunk instance does the processing pipeline on the events. &lt;/P&gt;

&lt;P&gt;Please let me know if this answers your question! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 16:09:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-hostname-from-the-logs/m-p/327320#M97469</guid>
      <dc:creator>muebel</dc:creator>
      <dc:date>2017-04-13T16:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the hostname from the logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-hostname-from-the-logs/m-p/327321#M97470</link>
      <description>&lt;P&gt;I tried this one, it dint worked. Do I have to mention anything under host= in inputs.conf?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2017 21:48:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-hostname-from-the-logs/m-p/327321#M97470</guid>
      <dc:creator>kiran331</dc:creator>
      <dc:date>2017-04-13T21:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the hostname from the logs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-hostname-from-the-logs/m-p/327322#M97471</link>
      <description>&lt;P&gt;I think a + was missed in extracting expression:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^mail\.text\.([^\.]+\.[^\.]+)\.iphmx\.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is the documentation for your use case with example: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/Overridedefaulthostassignments#Example"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Data/Overridedefaulthostassignments#Example&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 05:39:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-hostname-from-the-logs/m-p/327322#M97471</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-14T05:39:19Z</dc:date>
    </item>
  </channel>
</rss>

