<?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 nested json logs during index time in Monitoring Splunk</title>
    <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414242#M5683</link>
    <description>&lt;P&gt;How does your location matter for the TZ you set? If the information is logged in UTC timezone (which the Z indicates), you should tell splunk to interpret it as UTC, not as Australia time.&lt;/P&gt;

&lt;P&gt;If you want things displayed in australia time, you do that with your user's timezone settings in splunk web, not with the props.conf. Telling splunk to index UTC logs as Australia/Sidney, will cause splunk to put skewed values into _time.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Oct 2018 07:20:57 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2018-10-12T07:20:57Z</dc:date>
    <item>
      <title>How to properly parse nested json logs during index time</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414235#M5676</link>
      <description>&lt;P&gt;Hi folks,&lt;BR /&gt;
I've struggled for a couple of days parsing a file that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{    "status": {        "timestamp": "2018-10-10T23:40:26.101Z",        "error_code": 0,        "error_message": null,        "elapsed": 14,        "credit_count": 1    },    "data": [        {            "id": 1,            "name": "Bitcoin",            "symbol": "BTC",            "slug": "bitcoin",            "circulating_supply": 17315325,            "total_supply": 17315325,            "max_supply": 21000000,            "date_added": "2013-04-28T00:00:00.000Z",            "num_market_pairs": 6324,            "cmc_rank": 1,            "last_updated": "2018-10-10T23:39:30.000Z",            "quote": {                "USD": {                    "price": 6593.07839577,                    "volume_24h": 3781676977.17942,                    "percent_change_1h": 0.299567,                    "percent_change_24h": -0.633751,                    "percent_change_7d": 0.95377,                    "market_cap": 114161295173.23618,                    "last_updated": "2018-10-10T23:39:30.000Z"                }            }        },        {            "id": 1027,            "name": "Ethereum",            "symbol": "ETH",            "slug": "ethereum",            "circulating_supply": 102492584.749,            "total_supply": 102492584.749,            "max_supply": null,            "date_added": "2015-08-07T00:00:00.000Z",            "num_market_pairs": 4471,            "cmc_rank": 2,            "last_updated": "2018-10-10T23:39:42.000Z",            "quote": {                "USD": {                    "price": 225.917892111,                    "volume_24h": 1382931374.09404,                    "percent_change_1h": 0.569086,                    "percent_change_24h": -0.704234,                    "percent_change_7d": 1.85499,                    "market_cap": 23154908703.502106,                    "last_updated": "2018-10-10T23:39:42.000Z"                }            }        },        {            "id": 52,            "name": "XRP",            "symbol": "XRP",            "slug": "ripple",            "circulating_supply": 39997634397,            "total_supply": 99991817275,            "max_supply": 100000000000,            "date_added": "2013-08-04T00:00:00.000Z",            "num_market_pairs": 230,            "cmc_rank": 3,            "last_updated": "2018-10-10T23:40:09.000Z",            "quote": {                "USD": {                    "price": 0.461478997819,                    "volume_24h": 411665959.164198,                    "percent_change_1h": 0.445149,                    "percent_change_24h": -3.5819,                    "percent_change_7d": -13.0624,                    "market_cap": 18458068236.65832,                    "last_updated": "2018-10-10T23:40:09.000Z"                }            }        },        {            "id": 1831,            "name": "Bitcoin Cash",            "symbol": "BCH",            "slug": "bitcoin-cash",            "circulating_supply": 17395525,            "total_supply": 17395525,            "max_supply": 21000000,            "date_added": "2017-07-23T00:00:00.000Z",            "num_market_pairs": 342,            "cmc_rank": 4,            "last_updated": "2018-10-10T23:39:36.000Z",            "quote": {                "USD": {                    "price": 512.630430925,                    "volume_24h": 369198906.22134,                    "percent_change_1h": 0.365485,                    "percent_change_24h": -0.745641,                    "percent_change_7d": -1.26889,                    "market_cap": 8917475476.91661,                    "last_updated": "2018-10-10T23:39:36.000Z"                }            }        },        {            "id": 1765,            "name": "EOS",            "symbol": "EOS",            "slug": "eos",            "circulating_supply": 906245117.6,            "total_supply": 1006245119.9339,            "max_supply": null,            "date_added": "2017-07-01T00:00:00.000Z",            "num_market_pairs": 174,            "cmc_rank": 5,            "last_updated": "2018-10-10T23:39:36.000Z",            "quote": {                "USD": {                    "price": 5.88204493255,                    "volume_24h": 532584590.023657,                    "percent_change_1h": 0.326144,                    "percent_change_24h": -0.205986,                    "percent_change_7d": 4.79873,                    "market_cap": 5330574501.627259,                    "last_updated": "2018-10-10T23:39:36.000Z"                }            }        },        {            "id": 512,            "name": "Stellar",            "symbol": "XLM",            "slug": "stellar",            "circulating_supply": 18890616791.6665,            "total_supply": 104363617748.491,            "max_supply": null,            "date_added": "2014-08-05T00:00:00.000Z",            "num_market_pairs": 120,            "cmc_rank": 6,            "last_updated": "2018-10-10T23:39:19.000Z",            "quote": {                "USD": {                    "price": 0.241243489647,                    "volume_24h": 40002371.0719364,                    "percent_change_1h": 0.417773,                    "percent_change_24h": -1.36287,                    "percent_change_7d": -0.740479,                    "market_cap": 4557238316.405842,                    "last_updated": "2018-10-10T23:39:19.000Z"                }            }        },
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I need to do is:&lt;BR /&gt;
 -extract the timestamp, which I'm doing successfully&lt;BR /&gt;
- extract each coin and all the related information, including the nested "quote" as single event (the actual coin info starts after each "id", and finishes on the &lt;EM&gt;},&lt;/EM&gt; )&lt;BR /&gt;
-all info before "data" can be suppressed&lt;/P&gt;

&lt;P&gt;My current sourcetype looks like this:&lt;BR /&gt;
    [lalaland]&lt;BR /&gt;
    DATETIME_CONFIG = &lt;BR /&gt;
    KV_MODE = json&lt;BR /&gt;
    NO_BINARY_CHECK = true&lt;BR /&gt;
    SHOULD_LINEMERGE = true&lt;BR /&gt;
    TIME_FORMAT = %Y-%m-%dT%H:%M:%S.%3NT&lt;BR /&gt;
    TIME_PREFIX = \"timestamp\":&lt;BR /&gt;
    TZ = Australia/Sydney&lt;BR /&gt;
    category = Custom&lt;BR /&gt;
    pulldown_type = 1&lt;BR /&gt;
    BREAK_ONLY_BEFORE = \s*{\s*\"id\":&lt;BR /&gt;
    disabled = false&lt;BR /&gt;
    MAX_EVENTS = 10000&lt;/P&gt;

&lt;P&gt;What am I doing wrong?&lt;/P&gt;

&lt;P&gt;Tks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:32:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414235#M5676</guid>
      <dc:creator>ADRIANODL</dc:creator>
      <dc:date>2020-09-29T21:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse nested json logs during index time</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414236#M5677</link>
      <description>&lt;P&gt;Hi @ADRIANODL,&lt;/P&gt;

&lt;P&gt;Have you tried below configuration on Universal Forwarder ?&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yourSourcetype]
INDEXED_EXTRACTIONS = json
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Oct 2018 08:57:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414236#M5677</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-10-11T08:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse nested json logs during index time</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414237#M5678</link>
      <description>&lt;P&gt;That (on its own) is not going to help him split this data into separate events per coin.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 09:31:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414237#M5678</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-10-11T09:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse nested json logs during index time</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414238#M5679</link>
      <description>&lt;P&gt;I prefer to use the more explicit &lt;CODE&gt;LINE_BREAKER&lt;/CODE&gt; setting and set  &lt;CODE&gt;SHOULD_LINEMERGE&lt;/CODE&gt; to false.&lt;/P&gt;

&lt;P&gt;Also: Taking the timestamp from the 'header' and breaking the rest into separate events may not really be an option. Splunk expects a timestamp per (broken) event, not 1 timestamp and then a bunch of timestampless events. It might be possible to get that to work, but not sure if and how.&lt;/P&gt;

&lt;P&gt;Can you not use the last update time in each of the coin sections as the timestamp? Then you could use config somewhat like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[lalaland]
KV_MODE = json
NO_BINARY_CHECK = true
SHOULD_LINEMERGE = false
TIME_FORMAT = %Y-%m-%dT%H:%M:%S.%3NT
TIME_PREFIX = \"last_updated\"\:
TZ = Australia/Sydney
category = Custom
pulldown_type = 1
LINE_BREAKER = (?:(^[^\[]+\[\s+)\{\s+\"id\"\:|(,\s+)\{\s+\"id\"\:)
disabled = false
MAX_EVENTS = 10000
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;regex101 link for the linebreaker regex: &lt;A href="https://regex101.com/r/UfbLif/1"&gt;https://regex101.com/r/UfbLif/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 09:45:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414238#M5679</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-10-11T09:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse nested json logs during index time</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414239#M5680</link>
      <description>&lt;P&gt;Perfect one, I didn't look at question properly to break events for every coin. Still I am getting timestamp recognition error on 7.2 in my lab (may be due to &lt;CODE&gt;%3NT&lt;/CODE&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 10:38:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414239#M5680</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-10-11T10:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse nested json logs during index time</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414240#M5681</link>
      <description>&lt;P&gt;Oh, yes, I didn't double check that part. That should be a Z instead of a T of course. Or even a %Z if you actually want to capture that Z as the indicator for Zulu (UTC) timezone.&lt;/P&gt;

&lt;P&gt;Bit strange by they way to set TZ = Australia/Sydney, while the logs mention that Z, meaning Zulu (UTC) timezone...&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 11:53:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414240#M5681</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-10-11T11:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse nested json logs during index time</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414241#M5682</link>
      <description>&lt;P&gt;Hi Frank,&lt;BR /&gt;
This is because the source of that info is based in the US, whilst we're based in AU.&lt;BR /&gt;
:)&lt;/P&gt;

&lt;P&gt;Thanks for the response, guys! Seems to be working fine!&lt;/P&gt;</description>
      <pubDate>Thu, 11 Oct 2018 23:06:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414241#M5682</guid>
      <dc:creator>ADRIANODL</dc:creator>
      <dc:date>2018-10-11T23:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to properly parse nested json logs during index time</title>
      <link>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414242#M5683</link>
      <description>&lt;P&gt;How does your location matter for the TZ you set? If the information is logged in UTC timezone (which the Z indicates), you should tell splunk to interpret it as UTC, not as Australia time.&lt;/P&gt;

&lt;P&gt;If you want things displayed in australia time, you do that with your user's timezone settings in splunk web, not with the props.conf. Telling splunk to index UTC logs as Australia/Sidney, will cause splunk to put skewed values into _time.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2018 07:20:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Monitoring-Splunk/How-to-properly-parse-nested-json-logs-during-index-time/m-p/414242#M5683</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-10-12T07:20:57Z</dc:date>
    </item>
  </channel>
</rss>

