<?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 convert JSON into specific table format in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464599#M80109</link>
    <description>&lt;P&gt;Thanks Boss&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2020 19:11:50 GMT</pubDate>
    <dc:creator>rsharma1984</dc:creator>
    <dc:date>2020-02-10T19:11:50Z</dc:date>
    <item>
      <title>How to convert JSON into specific table format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464594#M80104</link>
      <description>&lt;P&gt;This what we have in logs:   &lt;CODE&gt;index="xyz" INFO certvalidationtask&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;And this prints a JSON object which consists of a list of commonName + ExpirationDate&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Stage.env e401a4ee-1652-48f6-8785-e8536524a317 [APP/PROC/WEB/0] - - 2020-02-10 16:09:01.525  INFO 22 --- [pool-1-thread-1] c.a.c.f.c.task.CertValidationTask        : {commonName='tiktok.com', expirationDate='2020-05-21 17:50:20'}{commonName='instagram.com', expirationDate='2020-07-11 16:56:37'}{commonName='blahblah.com', expirationDate='2020-12-08 11:30:42'}{commonName='advantage.com', expirationDate='2020-12-10 11:41:31'}{commonName='GHGHAGHGH', expirationDate='2021-05-19 08:34:03'}{commonName='Apple Google Word Wide exercise', expirationDate='2023-02-07 15:48:47'}{commonName='some internal cert1', expirationDate='2026-06-22 13:02:27'}{commonName='Some internal cert2', expirationDate='2036-06-22 11:23:21'}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I wanted a table which contains 2 columns -&amp;gt; Common Name &amp;amp; Expiration Date. Where if the expiration date is less than 30 days from the current date we show that in RED color, for less than 90 days we show in Yellow, everything else in Green.&lt;/P&gt;

&lt;P&gt;Much much thanks in Advanced.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 16:30:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464594#M80104</guid>
      <dc:creator>rsharma1984</dc:creator>
      <dc:date>2020-02-10T16:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert JSON into specific table format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464595#M80105</link>
      <description>&lt;P&gt;You could do this with rex and some eval&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="xyz" INFO certvalidationtask 
|rex max_match=0 "commonName=\'(?P&amp;lt;commonName&amp;gt;[^\']+)\'\,\sexpirationDate=\'(?P&amp;lt;expirationDate&amp;gt;[^\']+)"
|eval temp=mvzip(commonName,expirationDate,"#")
|mvexpand temp
|rex field=temp "(?&amp;lt;commonName&amp;gt;.+)#(?&amp;lt;expirationDate&amp;gt;.+)"
|eval expiresInDays=floor((strptime(expirationDate, "%Y-%m-%d %H:%M:%S") - now())/86400)
|table commonName expirationDate expiresInDays
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you can use table formatting to set your colours&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 17:27:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464595#M80105</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-10T17:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert JSON into specific table format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464596#M80106</link>
      <description>&lt;P&gt;Whoops - overlooked its multivalued.&lt;BR /&gt;
Edited to also use mvzip and mvexpand, otherwise it would only work for for the first cert.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 17:44:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464596#M80106</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-10T17:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert JSON into specific table format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464597#M80107</link>
      <description>&lt;P&gt;Thank you Genius @nickhillscpl &lt;/P&gt;

&lt;P&gt;Any idea on coloring?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 18:22:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464597#M80107</guid>
      <dc:creator>rsharma1984</dc:creator>
      <dc:date>2020-02-10T18:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert JSON into specific table format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464598#M80108</link>
      <description>&lt;P&gt;In the table view, click the little paintbrush icon at the top of each column. Select Colour-Ranges&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 19:08:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464598#M80108</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-10T19:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert JSON into specific table format</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464599#M80109</link>
      <description>&lt;P&gt;Thanks Boss&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 19:11:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-JSON-into-specific-table-format/m-p/464599#M80109</guid>
      <dc:creator>rsharma1984</dc:creator>
      <dc:date>2020-02-10T19:11:50Z</dc:date>
    </item>
  </channel>
</rss>

