<?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: Syslog Json question in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450083#M78146</link>
    <description>&lt;P&gt;Hello David, &lt;/P&gt;

&lt;P&gt;I dont fully understand how to use this spath command. Should I extract the json and use that as the input field? Is this only possible at search time? &lt;/P&gt;

&lt;P&gt;Can you maybe explain a little more on how to approach this?&lt;/P&gt;

&lt;P&gt;Thanks, kind regards,&lt;BR /&gt;
Willem&lt;/P&gt;</description>
    <pubDate>Wed, 14 Aug 2019 07:35:10 GMT</pubDate>
    <dc:creator>willemjongeneel</dc:creator>
    <dc:date>2019-08-14T07:35:10Z</dc:date>
    <item>
      <title>Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450081#M78144</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I've got a question on getting Splunk to extract key value pairs from syslog json events.&lt;/P&gt;

&lt;P&gt;The events look like this:&lt;/P&gt;

&lt;P&gt;&amp;lt;14&amp;gt;Mon Aug 12 12:29:29 UTC 2019Info: { //json part}\x00&lt;/P&gt;

&lt;P&gt;At first I tried with the standard _json sourcetype. This didnt work. So I tried to make a custom sourcetype that would remove the part before and after the json.&lt;/P&gt;

&lt;P&gt;I've tried to add &lt;BR /&gt;
SEDCMD-end=s/\x00//g&lt;BR /&gt;
SEDCMD-start=s/^[^{]+//g&lt;BR /&gt;
KV_mode=json&lt;/P&gt;

&lt;P&gt;When I test the sourcetype using  the add data wizard in Splunk web, I see the part before the json en after the json dissapear. After I changed the sourcetype to my custom sourcetype in the source of the data, this doesnt work and I still get events with the part before and after the json.&lt;/P&gt;

&lt;P&gt;The full sourcetype conf:&lt;/P&gt;

&lt;P&gt;ADD_EXTRA_TIME_FIELDS=True&lt;BR /&gt;
ANNOTATE_PUNCT=true&lt;BR /&gt;
AUTO_KV_JSON=true&lt;BR /&gt;
BREAK_ONLY_BEFORE_DATE=true&lt;BR /&gt;
CHARSET=UTF-8&lt;BR /&gt;
DEPTH_LIMIT=1000&lt;BR /&gt;
KV_mode=json&lt;BR /&gt;
LEARN_MODEL=true&lt;BR /&gt;
LEARN_SOURCETYPE=true&lt;BR /&gt;
LINE_BREAKER=([\r\n]+)&lt;BR /&gt;
LINE_BREAKER_LOOKBEHIND=100&lt;BR /&gt;
MATCH_LIMIT=100000&lt;BR /&gt;
MAX_DAYS_AGO=2000&lt;BR /&gt;
MAX_DAYS_HENCE=2&lt;BR /&gt;
MAX_DIFF_SECS_AGO=3600&lt;BR /&gt;
MAX_DIFF_SECS_HENCE=604800&lt;BR /&gt;
MAX_EVENTS=256&lt;BR /&gt;
MAX_TIMESTAMP_LOOKAHEAD=128&lt;BR /&gt;
NO_BINARY_CHECK=true&lt;BR /&gt;
SEDCMD-end=s/\x00//g&lt;BR /&gt;
SEDCMD-start=s/^[^{]+//g&lt;BR /&gt;
SEGMENTATION=indexing&lt;BR /&gt;
SEGMENTATION-all=full&lt;BR /&gt;
SEGMENTATION-inner=inner&lt;BR /&gt;
SEGMENTATION-outer=outer&lt;BR /&gt;
SEGMENTATION-raw=none&lt;BR /&gt;
SEGMENTATION-standard=standard&lt;BR /&gt;
SHOULD_LINEMERGE=true&lt;BR /&gt;
TRUNCATE=10000&lt;BR /&gt;
category=Custom&lt;BR /&gt;
description=Sourcetype voor SAM, dit haalt de extra syslog informatie weg en toont alleen de JSON&lt;BR /&gt;
detect_trailing_nulls=false&lt;BR /&gt;
disabled=false&lt;BR /&gt;
maxDist=100&lt;BR /&gt;
pulldown_type=true&lt;/P&gt;

&lt;P&gt;Extra information: &lt;/P&gt;

&lt;P&gt;This gets send to Splunk Cloud from a forwarder that receives this events over a TCP port. On the forwarder the port gets connected to the right index, and sourcetype. &lt;/P&gt;

&lt;P&gt;Can anyone advise me on how to get the key value pairs from these syslog/json events?&lt;/P&gt;

&lt;P&gt;Thank you in advance, kind regards,&lt;BR /&gt;
Willem&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:45:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450081#M78144</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2020-09-30T01:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450082#M78145</link>
      <description>&lt;P&gt;Hi @willemjongeneel,&lt;/P&gt;

&lt;P&gt;Have you tried using the &lt;CODE&gt;spath&lt;/CODE&gt; command ? &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You won't need any sed to apply it.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 06:51:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450082#M78145</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-08-14T06:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450083#M78146</link>
      <description>&lt;P&gt;Hello David, &lt;/P&gt;

&lt;P&gt;I dont fully understand how to use this spath command. Should I extract the json and use that as the input field? Is this only possible at search time? &lt;/P&gt;

&lt;P&gt;Can you maybe explain a little more on how to approach this?&lt;/P&gt;

&lt;P&gt;Thanks, kind regards,&lt;BR /&gt;
Willem&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 07:35:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450083#M78146</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2019-08-14T07:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450084#M78147</link>
      <description>&lt;P&gt;Hi @willemjongeneel,&lt;/P&gt;

&lt;P&gt;Yes you can use this command on the search interface. It will allow you to troubleshoot why the &lt;CODE&gt;KV_MODE =json&lt;/CODE&gt; isn't giving you any results and you'll know exactly what you need to keep from your raw data to get the extraction working. &lt;/P&gt;

&lt;P&gt;Once you identify that you can apply the right sed to reshape your data. You can also use &lt;CODE&gt;INDEXED_EXTRACTIONS = JSON&lt;/CODE&gt; instead of &lt;CODE&gt;KV_MODE = json&lt;/CODE&gt; for better performance.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 08:00:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450084#M78147</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-08-14T08:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450085#M78148</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;

&lt;P&gt;I got this working using a substring and spath. The full search is:&lt;/P&gt;

&lt;P&gt;index= | eval _raw=substr(_raw, 39, (len(_raw)-42)) | spath input=_raw&lt;/P&gt;

&lt;P&gt;This cuts off the part before and after the json. Is there a way to get this substring working from props.conf by using Splunk web (as I cannot change it in another way, because I'm using Splunk Cloud). &lt;/P&gt;

&lt;P&gt;Kind regards,&lt;BR /&gt;
Willem&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:46:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450085#M78148</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2020-09-30T01:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450086#M78149</link>
      <description>&lt;P&gt;Well you could use the sedcmd you already created to remove the un-wanted subtring on the HF before sending data to Splunk cloud. Include this as well : &lt;CODE&gt;INDEXED_EXTRACTIONS = JSON&lt;/CODE&gt;to replace &lt;CODE&gt;spath&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 09:55:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450086#M78149</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-08-14T09:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450087#M78150</link>
      <description>&lt;P&gt;Hello David,&lt;/P&gt;

&lt;P&gt;We are using universal forwarder, not heavy forwarder. Would this be possible using a universal forwarder? &lt;/P&gt;

&lt;P&gt;Kind regards,&lt;BR /&gt;
Willem&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 09:59:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450087#M78150</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2019-08-14T09:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450088#M78151</link>
      <description>&lt;P&gt;No, just on an HF, or you'll have to put the config on the indexers but you'll have to access props.conf file... so maybe get support to do that for you ?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 10:01:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450088#M78151</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-08-14T10:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450089#M78152</link>
      <description>&lt;P&gt;Here is the basic approach.&lt;BR /&gt;
Figure out how to modify your events so that they are &lt;EM&gt;VALID JSON&lt;/EM&gt;.  Use this tool to check: &lt;A href="https://jsonlint.com/"&gt;https://jsonlint.com/&lt;/A&gt;&lt;BR /&gt;
Once you know how to adjust them, fix them on the way in using &lt;CODE&gt;SEDCMD-&lt;/CODE&gt; or other transforms.&lt;BR /&gt;
DO NOT USE THE &lt;CODE&gt;_json&lt;/CODE&gt; SOURCETYPE!  Create your own sourcetype and use &lt;CODE&gt;KV_MODE = json&lt;/CODE&gt; in &lt;CODE&gt;props.conf&lt;/CODE&gt;.&lt;BR /&gt;
That's it.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2019 16:36:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450089#M78152</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-16T16:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450090#M78153</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;What do you mean by fix them on the way? Is this possible to do this by using the sourcetype wizard in splunk web? Or do I really need to access props.conf directly? Or is it necessary to have a HF in between to do this?&lt;/P&gt;

&lt;P&gt;Event format:&lt;BR /&gt;
Mon Aug 12 12:29:29 UTC 2019Info: { //json part}\x00&lt;/P&gt;

&lt;P&gt;Also, with SEDCMD I can remove the first part with "s/&amp;lt;.{1,40}Info:\s//g"&lt;BR /&gt;
For the last part I tried: "s/\x00//g" This somehow doesn't work. Do you have any idea why this is not working?&lt;/P&gt;

&lt;P&gt;Kind regards,&lt;BR /&gt;
Willem&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 12:02:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450090#M78153</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2019-08-21T12:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450091#M78154</link>
      <description>&lt;P&gt;Try adding additional &lt;CODE&gt;\\&lt;/CODE&gt; characters one by one until it works.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 16:18:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450091#M78154</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-09-02T16:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Syslog Json question</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450092#M78155</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;Took a while, but this worked for me. &lt;/P&gt;

&lt;P&gt;Thank you for your help!&lt;/P&gt;

&lt;P&gt;Kind regards,&lt;BR /&gt;
Willem Jongeneel&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2020 15:35:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Syslog-Json-question/m-p/450092#M78155</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2020-01-06T15:35:31Z</dc:date>
    </item>
  </channel>
</rss>

