<?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 JSON parsing after transforms in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/JSON-parsing-after-transforms/m-p/551039#M91490</link>
    <description>&lt;P&gt;Hello Splunk Community,&lt;/P&gt;&lt;P&gt;I have an issue with JSON parsing in Splunk and hope you can help me with that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Situation:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Logs arrive via syslog on our indexers&lt;/LI&gt;&lt;LI&gt;Inside my app I have the following inputs.conf&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[monitor:///here_is_the_correct_path]
disabled = false
host_segment = 3
index = buttercup
sourcetype = buttercup:server
host =​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;This is my props.conf&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[buttercup:server]
TZ = UTC
TIME_FORMAT = %Y-%m-%dT%H:%M:%S
DATETIME_CONFIG = 
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
category = Custom
description = buttercup Server Logs
pulldown_type = true
TRANSFORMS-afilter = setnull, setparsing-audit, setparsing-auth
TRANSFORMS-changesourcetype = change-buttercup-server-audit, change-buttercup-server-auth

[buttercup:server:audit]
TZ = UTC
TIME_FORMAT = %Y-%m-%dT%H:%M:%S
DATETIME_CONFIG = 
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
category = Custom
description = buttercup Server Auditlog
pulldown_type = true
SEDCMD-strip_prefix = s/^[^{]+//g

[buttercup:server:auth]
TZ = UTC
TIME_FORMAT = %Y-%m-%dT%H:%M:%S
DATETIME_CONFIG = 
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
category = Custom
description = buttercup Server Authenticationlog
pulldown_type = true​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;And my transforms.conf&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[change-buttercup-server-audit]
REGEX = buttercup_audit\:
FORMAT = sourcetype::buttercup:server:audit
DEST_KEY = MetaData:Sourcetype

[change-buttercup-server-auth]
REGEX = buttercup_auth\:
FORMAT = sourcetype::buttercup:server:auth
DEST_KEY = MetaData:Sourcetype

[setnull]
REGEX = .
DEST_KEY = queue
FORMAT = nullQueue

[setparsing-audit]
REGEX = buttercup_audit\:
DEST_KEY = queue
FORMAT = indexQueue

[setparsing-auth]
REGEX = buttercup_auth\:
DEST_KEY = queue
FORMAT = indexQueue​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Description:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;After the input to index buttercup and sourcetype buttercup:server I use TRANSFORMS-afilter first, to filter everything from the syslog stream that does not include audit or auth logs. Therefore, I am using the setnull/setparsing construct in transforms.conf&lt;/LI&gt;&lt;LI&gt;After the filtering process, data goes back into the indexQueue and I use TRANSFORMS-changesourcetype to assign the matching “buttercup:server:audit” or “buttercup:server:auth” sourcetype.&lt;/LI&gt;&lt;LI&gt;The filtering and sourcetype assigning processes are successful, which shows me that the construct is working fine&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The problem is that the audit log has a JSON structure which should be parsed by Splunk automatically. To achieve this, I use the SEDCMD for this sourcetype to remove the prefix in front of the JSON structure.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;This JSON parsing is working fine, when I do a manual file input and select buttercup:server:audit directly.&lt;/LI&gt;&lt;LI&gt;But this JSON parsing is not working for manual input when I select buttercup:server&lt;/LI&gt;&lt;LI&gt;Therefore, it is also not working for monitor input of the syslog stream (as buttercup:server will be used first)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the problem has something to do with the SEDCMD and when it will be handled. Do you have any idea, how to fix that? I was thinking about doing the SEDCMD part within an additional transforms instead but I don´t know how. I have also experimented with adding INDEXED_EXTRACTIONS=JSON and KV_MODE=none (and vise versa) to the sourcetype, but no success.&lt;/P&gt;</description>
    <pubDate>Mon, 10 May 2021 06:57:51 GMT</pubDate>
    <dc:creator>cornemrc</dc:creator>
    <dc:date>2021-05-10T06:57:51Z</dc:date>
    <item>
      <title>JSON parsing after transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-parsing-after-transforms/m-p/551039#M91490</link>
      <description>&lt;P&gt;Hello Splunk Community,&lt;/P&gt;&lt;P&gt;I have an issue with JSON parsing in Splunk and hope you can help me with that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Situation:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Logs arrive via syslog on our indexers&lt;/LI&gt;&lt;LI&gt;Inside my app I have the following inputs.conf&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[monitor:///here_is_the_correct_path]
disabled = false
host_segment = 3
index = buttercup
sourcetype = buttercup:server
host =​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;This is my props.conf&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[buttercup:server]
TZ = UTC
TIME_FORMAT = %Y-%m-%dT%H:%M:%S
DATETIME_CONFIG = 
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
category = Custom
description = buttercup Server Logs
pulldown_type = true
TRANSFORMS-afilter = setnull, setparsing-audit, setparsing-auth
TRANSFORMS-changesourcetype = change-buttercup-server-audit, change-buttercup-server-auth

[buttercup:server:audit]
TZ = UTC
TIME_FORMAT = %Y-%m-%dT%H:%M:%S
DATETIME_CONFIG = 
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
category = Custom
description = buttercup Server Auditlog
pulldown_type = true
SEDCMD-strip_prefix = s/^[^{]+//g

[buttercup:server:auth]
TZ = UTC
TIME_FORMAT = %Y-%m-%dT%H:%M:%S
DATETIME_CONFIG = 
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
category = Custom
description = buttercup Server Authenticationlog
pulldown_type = true​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;And my transforms.conf&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[change-buttercup-server-audit]
REGEX = buttercup_audit\:
FORMAT = sourcetype::buttercup:server:audit
DEST_KEY = MetaData:Sourcetype

[change-buttercup-server-auth]
REGEX = buttercup_auth\:
FORMAT = sourcetype::buttercup:server:auth
DEST_KEY = MetaData:Sourcetype

[setnull]
REGEX = .
DEST_KEY = queue
FORMAT = nullQueue

[setparsing-audit]
REGEX = buttercup_audit\:
DEST_KEY = queue
FORMAT = indexQueue

[setparsing-auth]
REGEX = buttercup_auth\:
DEST_KEY = queue
FORMAT = indexQueue​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Description:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;After the input to index buttercup and sourcetype buttercup:server I use TRANSFORMS-afilter first, to filter everything from the syslog stream that does not include audit or auth logs. Therefore, I am using the setnull/setparsing construct in transforms.conf&lt;/LI&gt;&lt;LI&gt;After the filtering process, data goes back into the indexQueue and I use TRANSFORMS-changesourcetype to assign the matching “buttercup:server:audit” or “buttercup:server:auth” sourcetype.&lt;/LI&gt;&lt;LI&gt;The filtering and sourcetype assigning processes are successful, which shows me that the construct is working fine&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The problem is that the audit log has a JSON structure which should be parsed by Splunk automatically. To achieve this, I use the SEDCMD for this sourcetype to remove the prefix in front of the JSON structure.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;This JSON parsing is working fine, when I do a manual file input and select buttercup:server:audit directly.&lt;/LI&gt;&lt;LI&gt;But this JSON parsing is not working for manual input when I select buttercup:server&lt;/LI&gt;&lt;LI&gt;Therefore, it is also not working for monitor input of the syslog stream (as buttercup:server will be used first)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the problem has something to do with the SEDCMD and when it will be handled. Do you have any idea, how to fix that? I was thinking about doing the SEDCMD part within an additional transforms instead but I don´t know how. I have also experimented with adding INDEXED_EXTRACTIONS=JSON and KV_MODE=none (and vise versa) to the sourcetype, but no success.&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 06:57:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-parsing-after-transforms/m-p/551039#M91490</guid>
      <dc:creator>cornemrc</dc:creator>
      <dc:date>2021-05-10T06:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: JSON parsing after transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/JSON-parsing-after-transforms/m-p/551871#M91591</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;we' ve solved the problem:&lt;/P&gt;&lt;P&gt;Props.conf - sourcetype buttercup:server was adjusted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[buttercup:server]
TZ = UTC
TIME_FORMAT = %Y-%m-%dT%H:%M:%S
DATETIME_CONFIG =
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = true
category = Custom
description = buttercup Server Logs
pulldown_type = true
TRANSFORMS-afilter = setnull, setparsing-audit, setparsing-auth
TRANSFORMS-changesourcetype = change-buttercup-server-audit, change-buttercup-server-auth
TRANSFORMS-strip-front-json = strip-front-json&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last line was added and this replaced also the SEDCMD command in the buttercup:server:audit sourcetype.&lt;/P&gt;&lt;P&gt;transforms.conf - added the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[strip-front-json]
REGEX = ((?&amp;lt;=buttercup_audit: )(.*))
FORMAT = $2
DEST_KEY = _raw&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main problem was, that after rewriting the sourcetype and filtering the events, the parsing does not have any effect anymore because it was already in the indexQueue.&lt;/P&gt;&lt;P&gt;SEDCMD whould have also worked in the sourcetype buttercup:server we think.&lt;/P&gt;&lt;P&gt;There is maybe a better/more efficient way of orderng the transforms, but it works for now.&lt;/P&gt;&lt;P&gt;Many Regards&lt;/P&gt;&lt;P&gt;Michael&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 May 2021 13:11:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/JSON-parsing-after-transforms/m-p/551871#M91591</guid>
      <dc:creator>deckemha</dc:creator>
      <dc:date>2021-05-17T13:11:21Z</dc:date>
    </item>
  </channel>
</rss>

