<?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 How to extract value from JSON then declare a variable? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-from-JSON-then-declare-a-variable/m-p/592029#M206087</link>
    <description>&lt;P&gt;I have HEC to send an event to Splunk in JSON format:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{ 
   Status: Down
   Source: GCP
   URL: url_1
}
{ 
   Status: Up
   Source: GCP
   URL: url_2
}
{ 
   Status: Down
   Source: AWS
   URL: url_1
}
{ 
   Status: Up
   Source: AWS
   URL: url_2
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I want to&amp;nbsp;extract value from JSON then declare a variable,&amp;nbsp;not sure should I use eval or stats&lt;BR /&gt;For example:&lt;BR /&gt;declare a variable&amp;nbsp;usl_1_aws_status, it should be Down&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;declare a variable&amp;nbsp;usl_2_gcp_status, it should be UP&lt;BR /&gt;&lt;BR /&gt;How to do I&amp;nbsp;extract value from JSON then declare a variable?&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Apr 2022 14:39:34 GMT</pubDate>
    <dc:creator>yiweishih</dc:creator>
    <dc:date>2022-04-04T14:39:34Z</dc:date>
    <item>
      <title>How to extract value from JSON then declare a variable?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-from-JSON-then-declare-a-variable/m-p/592029#M206087</link>
      <description>&lt;P&gt;I have HEC to send an event to Splunk in JSON format:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{ 
   Status: Down
   Source: GCP
   URL: url_1
}
{ 
   Status: Up
   Source: GCP
   URL: url_2
}
{ 
   Status: Down
   Source: AWS
   URL: url_1
}
{ 
   Status: Up
   Source: AWS
   URL: url_2
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I want to&amp;nbsp;extract value from JSON then declare a variable,&amp;nbsp;not sure should I use eval or stats&lt;BR /&gt;For example:&lt;BR /&gt;declare a variable&amp;nbsp;usl_1_aws_status, it should be Down&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;declare a variable&amp;nbsp;usl_2_gcp_status, it should be UP&lt;BR /&gt;&lt;BR /&gt;How to do I&amp;nbsp;extract value from JSON then declare a variable?&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 14:39:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-from-JSON-then-declare-a-variable/m-p/592029#M206087</guid>
      <dc:creator>yiweishih</dc:creator>
      <dc:date>2022-04-04T14:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract value from JSON then declare a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-from-JSON-then-declare-a-variable/m-p/592040#M206092</link>
      <description>&lt;P&gt;The easiest is perhaps&amp;nbsp;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transpose" target="_blank" rel="noopener"&gt;transpose&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval site_status=URL . "_" . Source . "_status"
| table site_status Status
| transpose header_field=site_status
| fields - column&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The sample data gives&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;url_1_GCP_status&lt;/TD&gt;&lt;TD&gt;url_2_GCP_status&lt;/TD&gt;&lt;TD&gt;url_1_AWS_status&lt;/TD&gt;&lt;TD&gt;url_2_AWS_status&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Down&lt;/TD&gt;&lt;TD&gt;Up&lt;/TD&gt;&lt;TD&gt;Down&lt;/TD&gt;&lt;TD&gt;Up&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 07:33:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-from-JSON-then-declare-a-variable/m-p/592040#M206092</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-04-02T07:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract value from JSON then declare a variable</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-from-JSON-then-declare-a-variable/m-p/592047#M206096</link>
      <description>&lt;P&gt;&lt;SPAN&gt;It worked!! Thank you so much!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 08:02:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-value-from-JSON-then-declare-a-variable/m-p/592047#M206096</guid>
      <dc:creator>yiweishih</dc:creator>
      <dc:date>2022-04-02T08:02:45Z</dc:date>
    </item>
  </channel>
</rss>

