<?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 indexRouting with customFilters to route based on log content in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/indexRouting-with-customFilters-to-route-based-on-log-content/m-p/565111#M100577</link>
    <description>&lt;P&gt;I would like to use indexRouting to move some log lines to a given index and have other log lines go to athe HEC's default index.&amp;nbsp; The log lines that I want to route are single-line json formatted as a HEC event.&amp;nbsp; Below is a pretty-printed example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "event":{
    "device":{
      "id":"dcef6f000bc7a6baffc0f0b5f000",
    },
    "logMessage":{
      "description":"Publishing to web socket",
      "domain":"WebSocketChannel",
      "severity":"debug"
    },
    "topic":"com.juneoven.dev.analytics"
  },
  "index":"analytics_logs_dev",
  "level":"INFO",
  "source":"dev.analytics",
  "sourcetype":"analytics-logs",
  "time":1630091106.076237
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other log lines are normal text logs (non-json formatted):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2021-08-27 19:09:14,295 INFO [tornado.access] 202 POST /1/analytics/log (10.110.4.224) 35.62ms&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see that there is a customFilter feature.&amp;nbsp; I am hoping that Ican&amp;nbsp; key off of the 'index' field in the HEC event to route these json log lines to their index and allow all other lines to go to the default index for the HEC.&lt;BR /&gt;&lt;BR /&gt;Is that possible?&amp;nbsp; Is there some documentation that would help me?&amp;nbsp; Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Aug 2021 19:19:54 GMT</pubDate>
    <dc:creator>Ezward</dc:creator>
    <dc:date>2021-08-27T19:19:54Z</dc:date>
    <item>
      <title>indexRouting with customFilters to route based on log content</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/indexRouting-with-customFilters-to-route-based-on-log-content/m-p/565111#M100577</link>
      <description>&lt;P&gt;I would like to use indexRouting to move some log lines to a given index and have other log lines go to athe HEC's default index.&amp;nbsp; The log lines that I want to route are single-line json formatted as a HEC event.&amp;nbsp; Below is a pretty-printed example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "event":{
    "device":{
      "id":"dcef6f000bc7a6baffc0f0b5f000",
    },
    "logMessage":{
      "description":"Publishing to web socket",
      "domain":"WebSocketChannel",
      "severity":"debug"
    },
    "topic":"com.juneoven.dev.analytics"
  },
  "index":"analytics_logs_dev",
  "level":"INFO",
  "source":"dev.analytics",
  "sourcetype":"analytics-logs",
  "time":1630091106.076237
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other log lines are normal text logs (non-json formatted):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2021-08-27 19:09:14,295 INFO [tornado.access] 202 POST /1/analytics/log (10.110.4.224) 35.62ms&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see that there is a customFilter feature.&amp;nbsp; I am hoping that Ican&amp;nbsp; key off of the 'index' field in the HEC event to route these json log lines to their index and allow all other lines to go to the default index for the HEC.&lt;BR /&gt;&lt;BR /&gt;Is that possible?&amp;nbsp; Is there some documentation that would help me?&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Aug 2021 19:19:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/indexRouting-with-customFilters-to-route-based-on-log-content/m-p/565111#M100577</guid>
      <dc:creator>Ezward</dc:creator>
      <dc:date>2021-08-27T19:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: indexRouting with customFilters to route based on log content</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/indexRouting-with-customFilters-to-route-based-on-log-content/m-p/565208#M100588</link>
      <description>&lt;P&gt;You can use a transform to rewrite the index metadata field of an event.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/admin/transformsconf#KEYS:" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/latest/admin/transformsconf#KEYS:&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So in a props.conf you do&lt;/P&gt;&lt;PRE&gt;[mysourcetype]&lt;BR /&gt;TRANSFORMS-redirect=redirect_to_index2&lt;/PRE&gt;&lt;P&gt;And in transforms.conf (assuming you want to redirect json events:&lt;/P&gt;&lt;PRE&gt;[redirect_to_index2]&lt;BR /&gt;REGEX = {.*}&lt;BR /&gt;FORMAT = index2&lt;BR /&gt;DEST_KEY = _MetaData:Index&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: I'm not sure if {} don't need to be escaped in regex.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 09:18:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/indexRouting-with-customFilters-to-route-based-on-log-content/m-p/565208#M100588</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-08-30T09:18:37Z</dc:date>
    </item>
  </channel>
</rss>

