<?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 properly parse my JSON input? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364688#M66438</link>
    <description>&lt;P&gt;Still working on it but this far thus far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DATETIME_CONFIG = NONE
KV_MODE = json
LINE_BREAKER = },(\s+)
MAX_TIMESTAMP_LOOKAHEAD = 25
NO_BINARY_CHECK = true
TIME_FORMAT = %FT%T
TIME_PREFIX = CreationTime\W+
TZ = UTC
category = Custom
disabled = false
pulldown_type = true
SHOULD_LINEMERGE = false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 18 Mar 2017 00:44:22 GMT</pubDate>
    <dc:creator>sloshburch</dc:creator>
    <dc:date>2017-03-18T00:44:22Z</dc:date>
    <item>
      <title>How to properly parse my JSON input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364684#M66434</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a JSON input file, and am having two issues.  First, I can't seem to get the timestamp to map appropriately, and second, the events don't appear as proper JSON events within Splunk.   &lt;/P&gt;

&lt;P&gt;Here's a sample event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[
    {
        "PSComputerName":  "testaaaaaaaa",
        "RunspaceId":  "c98aff32-7a72-4",
        "PSShowComputerName":  false,
        "RecordType":  "SharePointFileOperation",
        "CreationDate":  "\/Date(1489501679000)\/",
        "UserIds":  "srvfp123@mycompany.com",
        "Operations":  "FileAccessed",
        "AuditData":  "{\"CreationTime\":\"2017-03-14T14:27:59\",\"Id\":\"20187-f36f-bc-a7cb-050e2\",\"Operation\":\"FileAccessed\",\"OrganizationId\":\"75cbc-a68c-41e5-b95-1cfzzz6dd19\",\"RecordType\":6,\"UserKey\":\"i:0h.f|membership|10lskdjflkj90892a46@live.com\",\"UserType\":0,\"Version\":1,\"Workload\":\"SharePoint\",\"ClientIP\":\"1.12.25.1\",\"ObjectId\":\"https:\\/\\/sp.cloud.com\\/sites\\/workbench\\/pi\\/Topics\\/Concept8972e-af4d-4bc-8361-647d9b49cc7e.xml\",\"UserId\":\"srvfp2spo@.com\",\"EventSource\":\"SharePoint\",\"ItemType\":\"File\",\"ListId\":\"12ffce27-9e06-4672-8079-41d9ad911255\",\"ListItemUniqueId\":\"5a61cb68-01bb-43ff-a83b-cc6aafc325ca\",\"Site\":\"b9738191-350f-4d0e-8bd0-8be1dd1ec55a\",\"UserAgent\":\"\",\"WebId\":\"49b2d22c-c0f8-4d8d-b4ad-de22a35d8d57\",\"SourceFileExtension\":\"xml\",\"SiteUrl\":\"https:\\/\\/sp.fmrcloud.com\\/sites\\/workbench\\/\",\"SourceFileName\":\"Concept89eab72e-af4d-49bc-8361-647d9b49cc7e.xml\",\"SourceRelativeUrl\":\"\\/sites\\/workbench\\/pi\\/Topics\\/Concept89eab72e-af4d-49bc-8361-647d9b49cc7e.xml\"}",
        "ResultIndex":  1,
        "ResultCount":  3295,
        "Identity":  "2ca27-f36f-48bc-a7cb-08d0e2",
        "IsValid":  true,
        "ObjectState":  "Unchanged"
    },
    {
        "PSComputerName":  "mail-nam.mcld.oud.com",
        "RunspaceId":  "cff32-7a72-4213-8760-e55469e",
        "PSShowComputerName":  false,
        "RecordType":  "SharePointFileOperation",
        "CreationDate":  "\/Date(1489501679000)\/",
        "UserIds":  "z524@company.com",
        "Operations":  "FileAccessed",
        "AuditData":  "{\"CreationTime\":\"2017-03-14T14:27:59\",\"Id\":\"c8c8eb-9ed2-4a48-934a-08e65072\",\"Operation\":\"FileAccessed\",\"OrganizationId\":\"75bc-a68c-41e5-a3455-1cf830619\",\"RecordType\":6,\"UserKey\":\"i:0h.f|membership|10033fff9b1ba6ce@lze.com\",\"UserType\":0,\"Version\":1,\"Workload\":\"SharePoint\",\"ClientIP\":\"137.199.241.16\",\"ObjectId\":\"https:\\/\\/sp.cloud.com\\/sites\\/workbench\\/pi\\/Maps\\/36d42faf-d405-480f-8e28-9c8db9e7e.xml\",\"UserId\":\"z98824@company.com\",\"EventSource\":\"SharePoint\",\"ItemType\":\"File\",\"ListId\":\"34409-7160-425b-8a46-d5af7b3\",\"ListItemUniqueId\":\"b656-1242-43a3-aa7c-169e910a\",\"Site\":\"b9738191-350f-4d0e-80-8be1dec55a\",\"UserAgent\":\"Mozilla\\/5.0 (Windows NT 6.1; WOW64; Trident\\/7.0; rv:11.0) like Gecko\",\"WebId\":\"492c-c0f8-4d8d-b4ad-de5d8d57\",\"SourceFileExtension\":\"xml\",\"SiteUrl\":\"https:\\/\\/sp.cloud.com\\/sites\\/workbench\\/\",\"SourceFileName\":\"3xxfaf-d405-480f-8e28-9c8cb9e7e.xml\",\"SourceRelativeUrl\":\"pi\\/Maps\"}",
        "ResultIndex":  2,
        "ResultCount":  3295,
        "Identity":  "z23ta28eb-9ed2-4a48-934a-08072",
        "IsValid":  true,
        "ObjectState":  "Unchanged"
    },
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is my props:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;BREAK_ONLY_BEFORE_DATE = false
LINE_BREAKER = (,[\r\n]+\s+)\{
KV_MODE=json
TZ=UTC
TIME_PREFIX = \"CreationTime\":\s*\"
MAX_TIMESTAMP_LOOKAHEAD = 35
KV_MODE=json
TZ = UTC
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Mar 2017 14:25:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364684#M66434</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2017-03-16T14:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse my JSON input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364685#M66435</link>
      <description>&lt;P&gt;So, the message you posted isn't valid JSON. I validate json format using &lt;A href="https://jsonformatter.curiousconcept.com"&gt;https://jsonformatter.curiousconcept.com&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;But, my bet is that the message is valid json, but you didn't paste the full message.&lt;/P&gt;

&lt;P&gt;Splunk is probably truncating the message.&lt;/P&gt;

&lt;P&gt;If you are certain that this will always be valid data, set&lt;BR /&gt;
props.conf&lt;BR /&gt;
TRUNCATE = 0&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.2/Admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.2/Admin/Propsconf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 14:35:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364685#M66435</guid>
      <dc:creator>bshuler_splunk</dc:creator>
      <dc:date>2017-03-16T14:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse my JSON input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364686#M66436</link>
      <description>&lt;P&gt;Those are two events within the file.  I couldn't post the whole file - it's huge.  I don't want one huge file as the event - separate events within the file. &lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 14:40:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364686#M66436</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2017-03-16T14:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse my JSON input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364687#M66437</link>
      <description>&lt;P&gt;Anyone?  More concerned with the date than the json format at this point...&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2017 22:06:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364687#M66437</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2017-03-16T22:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse my JSON input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364688#M66438</link>
      <description>&lt;P&gt;Still working on it but this far thus far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DATETIME_CONFIG = NONE
KV_MODE = json
LINE_BREAKER = },(\s+)
MAX_TIMESTAMP_LOOKAHEAD = 25
NO_BINARY_CHECK = true
TIME_FORMAT = %FT%T
TIME_PREFIX = CreationTime\W+
TZ = UTC
category = Custom
disabled = false
pulldown_type = true
SHOULD_LINEMERGE = false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Mar 2017 00:44:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364688#M66438</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2017-03-18T00:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse my JSON input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364689#M66439</link>
      <description>&lt;P&gt;Thanks.  Didn't work, unfortunately. &lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 11:08:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364689#M66439</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2017-03-20T11:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse my JSON input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364690#M66440</link>
      <description>&lt;P&gt;I just noticed that there are commas in between each event in the sample provided which is causing a json parsing error. I'm not json expect but I'm inclined to think that there shouldn't be commas between json items and only in between the json field/attribute pairs.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 21:18:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364690#M66440</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2017-03-21T21:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse my JSON input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364691#M66441</link>
      <description>&lt;P&gt;Ok, second time's the charm. I got it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[new_sourcetype]
DATETIME_CONFIG = 
KV_MODE = json
LINE_BREAKER = \}(\,?[\r\n]+)\{?
MAX_TIMESTAMP_LOOKAHEAD = 25
NO_BINARY_CHECK = true
TIME_PREFIX = CreationTime\D+
TZ = UTC
category = Custom
disabled = false
pulldown_type = true
SHOULD_LINEMERGE = false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As far as I understand the syntax won't be pretty printed automatically (it's available in the UI per event) because the json already has formatting applied to it with white spaces and carriage returns. I guess if Splunk see's a single line json, it pretty-prints it but if you added in your own spacing it honors your intentions and displays it that way.&lt;/P&gt;

&lt;P&gt;Lastly, and probably most importantly, the &lt;CODE&gt;AuditData&lt;/CODE&gt; field has it's own json payload. To get that, you'll want to throw down this: &lt;CODE&gt;| spath input=AuditData&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;BTW, I see the example you provided leads off with an open bracket &lt;CODE&gt;[&lt;/CODE&gt;. Is that for real in the data? If so, you might want to scrub that out in the sourcetype.&lt;/P&gt;

&lt;P&gt;Results:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/2637i5C41CC777F4E6C60/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 21:55:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364691#M66441</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2017-03-21T21:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse my JSON input?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364692#M66442</link>
      <description>&lt;P&gt;Oh,  YOU are THE MAN.  Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 17:31:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-properly-parse-my-JSON-input/m-p/364692#M66442</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2017-03-22T17:31:21Z</dc:date>
    </item>
  </channel>
</rss>

