<?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 separate data from different sources going to same syslog port? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/how-to-separate-data-from-different-sources-going-to-same-syslog/m-p/68978#M13962</link>
    <description>&lt;P&gt;Make transform.conf entries which will rewrite the index:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Host1IndexRewrite]
DEST_KEY = _MetaData:Index
FORMAT = &amp;lt;Host1Index&amp;gt;

[Host2IndexRewrite]
DEST_KEY = _MetaData:Index
FORMAT = &amp;lt;Host2Index&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And in props.conf to match on the incoming host:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[host::&amp;lt;host1&amp;gt;]
TRANSFORMS-host1indexrewrite = Host1IndexRewrite

[host::&amp;lt;host2&amp;gt;]
TRANSFORMS-host2indexrewrite = Host2IndexRewrite
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, one caveat, this would put everything from those hosts in that index, not just based on source.  Hope that helps!&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Edit&lt;/STRONG&gt;: Someone pointed out to me you may need a regex to match before you can use format.  If the first doesn't work, the following would be worth a try for transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Host1IndexRewrite]
REGEX = .
DEST_KEY = _MetaData:Index
FORMAT = &amp;lt;Host1Index&amp;gt;

[Host2IndexRewrite]
REGEX = .
DEST_KEY = _MetaData:Index
FORMAT = &amp;lt;Host2Index&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 09 Feb 2012 18:41:19 GMT</pubDate>
    <dc:creator>clintsharp</dc:creator>
    <dc:date>2012-02-09T18:41:19Z</dc:date>
    <item>
      <title>how to separate data from different sources going to same syslog port?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-separate-data-from-different-sources-going-to-same-syslog/m-p/68977#M13961</link>
      <description>&lt;P&gt;Hi, I need help with the following.&lt;/P&gt;

&lt;P&gt;I have two distinct services in different machines. I want to send their logs/information to Splunk (in another machine/server). The two services can only send logs through udp/514 syslog. I can't change this setting at those services and I don't have where to write logs locally. &lt;/P&gt;

&lt;P&gt;How can I receive data in Splunk in the same port and separate data coming from different services to different indexes?  &lt;/P&gt;

&lt;P&gt;In inputs.conf for example I can't add more indexes right? And to filter the data to one index or another I need transforms.conf and props.conf! How?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;inputs.conf (at Splunk server)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;[udp://514]&lt;/P&gt;

&lt;P&gt;connection_host = ip&lt;/P&gt;

&lt;P&gt;index = my_syslog1&lt;/P&gt;

&lt;P&gt;sourcetype = syslog1&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2012 18:14:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-separate-data-from-different-sources-going-to-same-syslog/m-p/68977#M13961</guid>
      <dc:creator>fernandoandre</dc:creator>
      <dc:date>2012-02-09T18:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate data from different sources going to same syslog port?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-separate-data-from-different-sources-going-to-same-syslog/m-p/68978#M13962</link>
      <description>&lt;P&gt;Make transform.conf entries which will rewrite the index:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Host1IndexRewrite]
DEST_KEY = _MetaData:Index
FORMAT = &amp;lt;Host1Index&amp;gt;

[Host2IndexRewrite]
DEST_KEY = _MetaData:Index
FORMAT = &amp;lt;Host2Index&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And in props.conf to match on the incoming host:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[host::&amp;lt;host1&amp;gt;]
TRANSFORMS-host1indexrewrite = Host1IndexRewrite

[host::&amp;lt;host2&amp;gt;]
TRANSFORMS-host2indexrewrite = Host2IndexRewrite
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now, one caveat, this would put everything from those hosts in that index, not just based on source.  Hope that helps!&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Edit&lt;/STRONG&gt;: Someone pointed out to me you may need a regex to match before you can use format.  If the first doesn't work, the following would be worth a try for transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Host1IndexRewrite]
REGEX = .
DEST_KEY = _MetaData:Index
FORMAT = &amp;lt;Host1Index&amp;gt;

[Host2IndexRewrite]
REGEX = .
DEST_KEY = _MetaData:Index
FORMAT = &amp;lt;Host2Index&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Feb 2012 18:41:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-separate-data-from-different-sources-going-to-same-syslog/m-p/68978#M13962</guid>
      <dc:creator>clintsharp</dc:creator>
      <dc:date>2012-02-09T18:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate data from different sources going to same syslog port?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-separate-data-from-different-sources-going-to-same-syslog/m-p/68979#M13963</link>
      <description>&lt;P&gt;sorry, this is unclear for me! Could you please clarify?&lt;/P&gt;

&lt;P&gt;1) I leave everything like it is now on inputs.conf??&lt;/P&gt;

&lt;P&gt;2) what is this supposed to do "_MetaData:Index"?&lt;/P&gt;

&lt;P&gt;3) I would expect to see something like index=my_index1 and index=my_index2 for redirecting different sources. Will "Format" accomplish the same thing?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 11:22:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-separate-data-from-different-sources-going-to-same-syslog/m-p/68979#M13963</guid>
      <dc:creator>fernandoandre</dc:creator>
      <dc:date>2020-09-28T11:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to separate data from different sources going to same syslog port?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/how-to-separate-data-from-different-sources-going-to-same-syslog/m-p/68980#M13964</link>
      <description>&lt;P&gt;1) Yes, leave everything as specified in inputs.conf.  Essentially the index you specify becomes the default index.  In fact, you could simply make one props.conf and transforms.conf entry to override the index from the second host if you like.&lt;/P&gt;

&lt;P&gt;2) That changes the the index that the input writes to at index time.&lt;/P&gt;

&lt;P&gt;3) Format is the format for how to write to the field.  You're overriding the index in the transform.  Format can be used with regexes as well (see &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Transformsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Admin/Transformsconf&lt;/A&gt;), but since we're not we can just specify the index name.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2012 19:54:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/how-to-separate-data-from-different-sources-going-to-same-syslog/m-p/68980#M13964</guid>
      <dc:creator>clintsharp</dc:creator>
      <dc:date>2012-02-09T19:54:52Z</dc:date>
    </item>
  </channel>
</rss>

