<?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: Need Help Routing Subset of Docker Container Logs to Different Index in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Need-Help-Routing-Subset-of-Docker-Container-Logs-to-Different/m-p/543710#M90761</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try&amp;nbsp; below props and transforms.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;[sourcetype]&lt;/P&gt;&lt;P&gt;TRANSFORMS-docker = eventsRoute&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Transforms.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;REGEX= $DockerNodeHostName (If this doesn't work try to give a unique keyword that can differentiate from other events)&lt;/P&gt;&lt;P&gt;DEST_KEY =&amp;nbsp;_MetaData:Index&lt;/P&gt;&lt;P&gt;FORMAT = New index name&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this reply helps you please upvote it.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 14 Mar 2021 04:45:56 GMT</pubDate>
    <dc:creator>Vardhan</dc:creator>
    <dc:date>2021-03-14T04:45:56Z</dc:date>
    <item>
      <title>Need Help Routing Subset of Docker Container Logs to Different Index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-Help-Routing-Subset-of-Docker-Container-Logs-to-Different/m-p/543604#M90754</link>
      <description>&lt;P&gt;Hello Splunk Community, I could certainly use you help getting myself out of a rather large jam I'm in. I need guidance on how to properly re-route a subset of events generated by one of our applications running within a Docker Container before it is indexed by Splunk.&lt;/P&gt;&lt;P&gt;Our development team updated the logging mechanism of this application to no longer write this subset of events to a flat log file. The subset&amp;nbsp; of events is now being written out to STDOUT/STDERR within the container itself. This means the specific events I need to extract are now being lumped into the same index as every other container processes events running on the same Docker Swarm.&lt;/P&gt;&lt;P&gt;This is causing a problem for me as I am new to administering Splunk and struggling to understand if it's going to be possible to extract this specific subset of events I need while filtering out the noise of every other container process writing events to the same index.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get data in from Docker, we are using the Splunk Logging Driver for Docker and have replaced "/etc/docker/daemon.json" config file with the following configuration file on all of our Docker Clusters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "metrics-addr": "0.0.0.0:9323",
  "experimental": true,
  "log-driver": "splunk",
  "log-opts": {
    "splunk-format": "json",
    "splunk-verify-connection": "false", 
    "splunk-token": "TOKEN",
    "splunk-url": "URL-TO-SPLUNK",
    "splunk-insecureskipverify": "true",
    "tag": "{{.DaemonName}}/{{.Hostname}}/{{.Name}}/{{.ID}}"
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The HEC Token we have configured for Docker events is as follows&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[http://docker]
disabled = 0
index = main
sourcetype = hec:swarm
token = $HEC-Token
useACK = 0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since we use the same HEC Token across all of our Docker Swarms, we have some Props.conf and Transforms.conf stanzas that were configured by an old co-worker to modify the index these events flow to based on source-type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#props.conf

[hec:swarm]
SEDCMD-0_hec_tags_rename = s/tag/tags/g
TRANSFORMS-0_hec_indexer = docker_change_index
TRANSFORMS-1_docker_sourcetyper = docker_sourcetyper
TRANSFORMS-9_clean_fields = clean_docker_sourcetypes
KV_MODE = json
ANNOTATE_PUNCT = false

[(::){0}json:platform:*]
ANNOTATE_PUNCT = false
KV_MODE = json
REPORT-vp_app_extract = vp_app_extract
REPORT-docker_msghdr_extract = docker_msghdr_extract
REPORT-docker_auth_events_extract = docker_auth_events_extract
REPORT-docker_kv_extract = inline_kv_extract
EVAL-action = case(event == "Authentication failed", "failure", event == "Authentication success", "success", true(), null())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#Transforms.conf 

# Extract Message Header
[docker_msghdr_extract]
REGEX = \,\d{3} [^A-Z]+(?&amp;lt;level&amp;gt;\S+)(?:[^\[]+\[){2}\d+m(?&amp;lt;process&amp;gt;[^\\]+)

# Extarct Authentication Events
[docker_auth_events_extract]
REGEX = (?&amp;lt;event&amp;gt;Authentication [^\:]+)

# Extract KV pairs
[docker_kv_extract]
REGEX = (\S+) = [']*([^,"']*)
FORMAT = $1::$2

# Extract platform application
[vp_app_extract]
#REGEX = tags\":\"docker(?:[^_]+)_[^_]+_(?&amp;lt;app&amp;gt;[^\.]+)
REGEX = tags\":\"docker\/(?:[^\/]+)\/(?&amp;lt;stack&amp;gt;[a-zA-Z-]+)_(?&amp;lt;app&amp;gt;[^\.]+)

####### SOURCETYPERS #########################
[docker_sourcetyper]
DEST_KEY = MetaData:Sourcetype
REGEX = tags\":[^\/]+\/(?:[^-]+-){2}([^-]+)
FORMAT = sourcetype::json:platform:$1

####### CHANGE INDEX ############################
[docker_change_index]
DEST_KEY = _MetaData:Index
REGEX = \"tags\":\"docker/([^-]+)-([^-]+)-([^-]+)
FORMAT = $1$2_$3


####### CLEAN ############################
# Remove '-' from sourcetype
[clean_docker_sourcetypes]
INGEST_EVAL = sourcetype=replace(sourcetype, "(-|_)", "")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The event subset I'm trying to re-route to a different index contains information in the following format. This is a raw example pulled from Splunk after the event was indexed, and has been sanitized as much as possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"line":"$dockerContainerID,$YYYY-$MM-$DD:$HH:$MM:$SS,$AlphaNumericString,$AlphaString,$AlphaString,$AlphaString,$numericString,$AlphaString,$numericString,,,$DollarAmount,$AlphaString,$AlphaString,$AlphaString,$FloatingPointString,$FloatingPointString,$NumericString,$NumericSring","source":"stderr","tags":"docker/$DockerNodeHostName/$DockerStack_$StackApplication.1.0fj4pexdb3m16giqp1atrfco5/47fb3b6218d5"}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on our current configuration could anyone lend a guiding hand on my best path forward to extract this subset of events out and redirect them to their own index, if what I'm attempting is at all possible. I fear that it is not because every container process is writing to the same index, has the same, host, source, and source-type. Based on my understanding of how Props.conf stanzas are defined I'm not sure that I can define any rules that won't effect every event.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[&amp;lt;spec&amp;gt;]
* This stanza enables properties for a given &amp;lt;spec&amp;gt;.
* A props.conf file can contain multiple stanzas for any number of
  different &amp;lt;spec&amp;gt;.
* Follow this stanza name with any number of the following setting/value
  pairs, as appropriate for what you want to do.
* If you do not set a setting for a given &amp;lt;spec&amp;gt;, the default is used.

&amp;lt;spec&amp;gt; can be:
1. &amp;lt;sourcetype&amp;gt;, the source type of an event.
2. host::&amp;lt;host&amp;gt;, where &amp;lt;host&amp;gt; is the host, or host-matching pattern, for an
                 event.
3. source::&amp;lt;source&amp;gt;, where &amp;lt;source&amp;gt; is the source, or source-matching
                     pattern, for an event.
4. rule::&amp;lt;rulename&amp;gt;, where &amp;lt;rulename&amp;gt; is a unique name of a source type
                     classification rule.
5. delayedrule::&amp;lt;rulename&amp;gt;, where &amp;lt;rulename&amp;gt; is a unique name of a delayed
                            source type classification rule.
                            These are only considered as a last resort
                            before generating a new source type based on the
                            source seen.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 23:54:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-Help-Routing-Subset-of-Docker-Container-Logs-to-Different/m-p/543604#M90754</guid>
      <dc:creator>TheColorBlack</dc:creator>
      <dc:date>2021-03-12T23:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help Routing Subset of Docker Container Logs to Different Index</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Need-Help-Routing-Subset-of-Docker-Container-Logs-to-Different/m-p/543710#M90761</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try&amp;nbsp; below props and transforms.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;[sourcetype]&lt;/P&gt;&lt;P&gt;TRANSFORMS-docker = eventsRoute&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Transforms.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;REGEX= $DockerNodeHostName (If this doesn't work try to give a unique keyword that can differentiate from other events)&lt;/P&gt;&lt;P&gt;DEST_KEY =&amp;nbsp;_MetaData:Index&lt;/P&gt;&lt;P&gt;FORMAT = New index name&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this reply helps you please upvote it.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 04:45:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Need-Help-Routing-Subset-of-Docker-Container-Logs-to-Different/m-p/543710#M90761</guid>
      <dc:creator>Vardhan</dc:creator>
      <dc:date>2021-03-14T04:45:56Z</dc:date>
    </item>
  </channel>
</rss>

