<?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>question Re: Please help me  to get count of particular field value  in json file using nifi in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223851#M79662</link>
    <description>&lt;P&gt;Hi @&lt;A href="https://community.hortonworks.com/users/79158/vmurakami.html"&gt;Vinicius Higa Murakami&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks for your time and support . Your solution is help full to me . here we are running on windows machine .&lt;/P&gt;&lt;P&gt;I was used below flow but it was not working &lt;/P&gt;&lt;P&gt;Getmongo-&amp;gt;update attribute-&amp;gt;queryrecord-&amp;gt;mergecontent-&amp;gt;  query record(this was not working) --&amp;gt;putfile&lt;/P&gt;&lt;P&gt;flowfile structure(Json file)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;projectshortname:AAAA&lt;/P&gt;&lt;P&gt;projectid:5885858&lt;/P&gt;&lt;P&gt;caseid:1111&lt;/P&gt;&lt;P&gt;},&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;projectshortname:BBBB&lt;/P&gt;&lt;P&gt;projectid:5885858&lt;/P&gt;&lt;P&gt;caseid:222222&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;query record used below query &lt;/P&gt;&lt;P&gt;with prj
  as
  (
  select projectshortname,projectid,caseid, count(caseid) as cnt
FROM FLOWFILE group by projectshortname,projectid,caseid
  )
  select projectshortname,projectid,caseid, cnt,  SUM(cnt) OVER () AS total_records
  from prj order by caseid&lt;/P&gt;&lt;P&gt;mergecontent- used for combining all flow files &lt;/P&gt;&lt;P&gt;queryrecord: applying query record for the consolidated file &lt;/P&gt;&lt;P&gt;but this was not working all the records in the file&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jun 2018 07:47:59 GMT</pubDate>
    <dc:creator>sdendukuri</dc:creator>
    <dc:date>2018-06-20T07:47:59Z</dc:date>
    <item>
      <title>Please help me  to get count of particular field value  in json file using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223846#M79657</link>
      <description />
      <pubDate>Mon, 18 Jun 2018 22:13:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223846#M79657</guid>
      <dc:creator>sdendukuri</dc:creator>
      <dc:date>2018-06-18T22:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me  to get count of particular field value  in json file using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223847#M79658</link>
      <description>&lt;P&gt;Hi &lt;A href="https://community.hortonworks.com/questions/198099/please-help-me-to-get-count-of-particular-field-va-1.html#" rel="nofollow noopener noreferrer" target="_blank"&gt;@Suresh Dendukuri&lt;/A&gt;!&lt;/P&gt;&lt;P&gt;You can use the following flow:&lt;/P&gt;&lt;P&gt;GetFile &amp;gt; EvaluateJsonPath &amp;gt; ExecuteStreamCommand or ExecuteScriptCommand &amp;gt; PutFile&lt;BR /&gt;On EvaluateJsonPath you will add the attributes from your json content, follows attached my example. &lt;BR /&gt;Ps: In my case i'm getting all value attribute from my json file under the *.service..source.reporting.. path.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="77731-screen-shot-2018-06-18-at-193503.png" style="width: 1662px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15543iB845F57172D5225E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="77731-screen-shot-2018-06-18-at-193503.png" alt="77731-screen-shot-2018-06-18-at-193503.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 01:49:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223847#M79658</guid>
      <dc:creator>vmurakami</dc:creator>
      <dc:date>2019-08-18T01:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me  to get count of particular field value  in json file using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223848#M79659</link>
      <description>&lt;P&gt;Thanks for your response. . But how to get count of one field from json file. for Example : file has empid,deptid,salary fields , how to get total records and number of employees ? &lt;/P&gt;&lt;P&gt;Apreciate your time and help&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 08:38:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223848#M79659</guid>
      <dc:creator>sdendukuri</dc:creator>
      <dc:date>2018-06-19T08:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me  to get count of particular field value  in json file using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223849#M79660</link>
      <description>&lt;P&gt;Thanks for your response. . But how to get count of one field from json file. for Example : file has empid,deptid,salary fields , how to get total records and number of employees  from each department&lt;/P&gt;&lt;P&gt;Apreciate your time and help&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 08:38:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223849#M79660</guid>
      <dc:creator>sdendukuri</dc:creator>
      <dc:date>2018-06-19T08:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me  to get count of particular field value  in json file using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223850#M79661</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/73297/sdendukuri.html" nodeid="73297" target="_blank"&gt;@Suresh Dendukuri&lt;/A&gt;!&lt;BR /&gt;I made a test here, and may serve to you:&lt;BR /&gt;I have a file called ambari.json with following content:&lt;/P&gt;&lt;PRE&gt;{
  "AMBARI_METRICS": {
    "service": [
      {
        "name": "metrics_monitor_process_percent",
        "label": "Percent Metrics Monitors Available",
        "description": "This alert is triggered if a percentage of Metrics Monitor processes are not up and listening on the network for the configured warning and critical thresholds.",
        "interval": 1,
        "scope": "SERVICE",
        "enabled": true,
        "source": {
          "type": "AGGREGATE",
          "alert_name": "ams_metrics_monitor_process",
          "reporting": {
            "ok": {
              "text": "affected: [{1}], total: [{0}]"
            },
            "warning": {
              "text": "affected: [{1}], total: [{0}]",
              "value": 10
            },
            "critical": {
              "text": "affected: [{1}], total: [{0}]",
              "value": 30
            },
            "units" : "%",
            "type": "PERCENT"
          }
        }
      }
    ],
    "METRICS_COLLECTOR": [
      {
        "name": "ams_metrics_collector_autostart",
        "label": "Metrics Collector - Auto-Restart Status",
        "description": "This alert is triggered if the Metrics Collector has been restarted automatically too frequently in last one hour. By default, a Warning alert is triggered if restarted twice in one hour and a Critical alert is triggered if restarted 4 or more times in one hour.",
        "interval": 1,
        "scope": "ANY",
        "enabled": true,
        "source": {
          "type": "RECOVERY",
          "reporting": {
            "ok": {
              "text": "Metrics Collector has not been auto-started and is running normally{0}."
            },
            "warning": {
              "text": "Metrics Collector has been auto-started {1} times{0}.",
              "count": 2
            },
            "critical": {
              "text": "Metrics Collector has been auto-started {1} times{0}.",
              "count": 4
            }
          }
        }
      },
      {
        "name": "ams_metrics_collector_process",
        "label": "Metrics Collector Process",
        "description": "This alert is triggered if the Metrics Collector cannot be confirmed to be up and listening on the configured port for number of seconds equal to threshold.",
        "interval": 1,
        "scope": "ANY",
        "enabled": true,
        "source": {
          "type": "PORT",
          "uri": "{{ams-site/timeline.metrics.service.webapp.address}}",
          "default_port": 6188,
          "reporting": {
            "ok": {
              "text": "TCP OK - {0:.3f}s response on port {1}"
            },
            "warning": {
              "text": "TCP OK - {0:.3f}s response on port {1}",
              "value": 1.5
            },
            "critical": {
              "text": "Connection failed: {0} to {1}:{2}",
              "value": 5.0
            }
          }
        }
      },
      {
        "name": "ams_metrics_collector_hbase_master_process",
        "label": "Metrics Collector - HBase Master Process",
        "description": "This alert is triggered if the Metrics Collector's HBase master processes cannot be confirmed to be up and listening on the network for the configured critical threshold, given in seconds.",
        "interval": 1,
        "scope": "ANY",
        "source": {
          "type": "PORT",
          "uri": "{{ams-hbase-site/hbase.master.info.port}}",
          "default_port": 61310,
          "reporting": {
            "ok": {
              "text": "TCP OK - {0:.3f}s response on port {1}"
            },
            "warning": {
              "text": "TCP OK - {0:.3f}s response on port {1}",
              "value": 1.5
            },
            "critical": {
              "text": "Connection failed: {0} to {1}:{2}",
              "value": 5.0
            }
          }
        }
      },
      {
        "name": "ams_metrics_collector_hbase_master_cpu",
        "label": "Metrics Collector - HBase Master CPU Utilization",
        "description": "This host-level alert is triggered if CPU utilization of the Metrics Collector's HBase Master exceeds certain warning and critical thresholds. It checks the HBase Master JMX Servlet for the SystemCPULoad property. The threshold values are in percent.",
        "interval": 5,
        "scope": "ANY",
        "enabled": true,
        "source": {
          "type": "METRIC",
          "uri": {
            "http": "{{ams-hbase-site/hbase.master.info.port}}",
            "default_port": 61310,
            "connection_timeout": 5.0
          },
          "reporting": {
            "ok": {
              "text": "{1} CPU, load {0:.1%}"
            },
            "warning": {
              "text": "{1} CPU, load {0:.1%}",
              "value": 200
            },
            "critical": {
              "text": "{1} CPU, load {0:.1%}",
              "value": 250
            },
            "units" : "%",
            "type": "PERCENT"
          },
          "jmx": {
            "property_list": [
              "java.lang:type=OperatingSystem/SystemCpuLoad",
              "java.lang:type=OperatingSystem/AvailableProcessors"
            ],
            "value": "{0} * 100"
          }
        }
      }
    ],
    "METRICS_MONITOR": [
      {
        "name": "ams_metrics_monitor_process",
        "label": "Metrics Monitor Status",
        "description": "This alert indicates the status of the Metrics Monitor process as determined by the monitor status script.",
        "interval": 1,
        "scope": "ANY",
        "source": {
          "type": "SCRIPT",
          "path": "AMBARI_METRICS/0.1.0/package/alerts/alert_ambari_metrics_monitor.py"
        }
      }
    ],
    "METRICS_GRAFANA": [
      {
        "name": "grafana_webui",
        "label": "Grafana Web UI",
        "description": "This host-level alert is triggered if the Grafana Web UI is unreachable.",
        "interval": 1,
        "scope": "ANY",
        "source": {
          "type": "WEB",
          "uri": {
              "http": "{{ams-grafana-ini/port}}",
              "https": "{{ams-grafana-ini/port}}",
              "https_property": "{{ams-grafana-ini/protocol}}",
              "https_property_value": "https",
              "connection_timeout": 5.0,
              "default_port": 3000
          },
          "reporting": {
              "ok": {
                  "text": "HTTP {0} response in {2:.3f}s"
              },
              "warning":{
                  "text": "HTTP {0} response from {1} in {2:.3f}s ({3})"
              },
              "critical": {
                  "text": "Connection failed to {1} ({3})"
              }
          }
        }
      }
    ]
  }
}


&lt;/PRE&gt;&lt;P&gt;And I want to sum the values from the value attrib under the AMBARI_METRICS.service.[0].source.reporting.*.value, so in my flow I'm using GETFILE &amp;gt; EVALUATEJSONPATH &amp;gt; EXTRACTTEXT &amp;gt; EXECUTESTREAMCOMMAND &amp;gt; PUTFIL.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="77754-screen-shot-2018-06-19-at-155134.png" style="width: 2620px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15538i0122CD05B7A76BA8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="77754-screen-shot-2018-06-19-at-155134.png" alt="77754-screen-shot-2018-06-19-at-155134.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In My GetFile I've:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="77755-screen-shot-2018-06-19-at-155223.png" style="width: 820px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15539i5D5A88850779726C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="77755-screen-shot-2018-06-19-at-155223.png" alt="77755-screen-shot-2018-06-19-at-155223.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the EvaluateJsonPath:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="77756-screen-shot-2018-06-19-at-155308.png" style="width: 839px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15540iF15803EA5E002F55/image-size/medium?v=v2&amp;amp;px=400" role="button" title="77756-screen-shot-2018-06-19-at-155308.png" alt="77756-screen-shot-2018-06-19-at-155308.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the &lt;/P&gt;&lt;P&gt;In the ExtractText&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="77757-screen-shot-2018-06-19-at-155354.png" style="width: 822px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15541i180041FE01CA3BA2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="77757-screen-shot-2018-06-19-at-155354.png" alt="77757-screen-shot-2018-06-19-at-155354.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the ExecuteStreamCommand:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="77758-screen-shot-2018-06-19-at-155432.png" style="width: 820px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/15542i434C112922B9CF30/image-size/medium?v=v2&amp;amp;px=400" role="button" title="77758-screen-shot-2018-06-19-at-155432.png" alt="77758-screen-shot-2018-06-19-at-155432.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And at the end, my putFile.&lt;/P&gt;&lt;P&gt;And here's the content of my shell script that Calculates each value from the value attribute and summarize to PutFile Processor.&lt;/P&gt;&lt;PRE&gt;#!/bin/bash
echo $@ | tr ',' '\n' | grep -o -E '[0-9]+' | paste -sd+ | b&lt;/PRE&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 01:48:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223850#M79661</guid>
      <dc:creator>vmurakami</dc:creator>
      <dc:date>2019-08-18T01:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me  to get count of particular field value  in json file using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223851#M79662</link>
      <description>&lt;P&gt;Hi @&lt;A href="https://community.hortonworks.com/users/79158/vmurakami.html"&gt;Vinicius Higa Murakami&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks for your time and support . Your solution is help full to me . here we are running on windows machine .&lt;/P&gt;&lt;P&gt;I was used below flow but it was not working &lt;/P&gt;&lt;P&gt;Getmongo-&amp;gt;update attribute-&amp;gt;queryrecord-&amp;gt;mergecontent-&amp;gt;  query record(this was not working) --&amp;gt;putfile&lt;/P&gt;&lt;P&gt;flowfile structure(Json file)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;projectshortname:AAAA&lt;/P&gt;&lt;P&gt;projectid:5885858&lt;/P&gt;&lt;P&gt;caseid:1111&lt;/P&gt;&lt;P&gt;},&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;projectshortname:BBBB&lt;/P&gt;&lt;P&gt;projectid:5885858&lt;/P&gt;&lt;P&gt;caseid:222222&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;query record used below query &lt;/P&gt;&lt;P&gt;with prj
  as
  (
  select projectshortname,projectid,caseid, count(caseid) as cnt
FROM FLOWFILE group by projectshortname,projectid,caseid
  )
  select projectshortname,projectid,caseid, cnt,  SUM(cnt) OVER () AS total_records
  from prj order by caseid&lt;/P&gt;&lt;P&gt;mergecontent- used for combining all flow files &lt;/P&gt;&lt;P&gt;queryrecord: applying query record for the consolidated file &lt;/P&gt;&lt;P&gt;but this was not working all the records in the file&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 07:47:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223851#M79662</guid>
      <dc:creator>sdendukuri</dc:creator>
      <dc:date>2018-06-20T07:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Please help me  to get count of particular field value  in json file using nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223852#M79663</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/73297/sdendukuri.html" nodeid="73297"&gt;@Suresh Dendukuri&lt;/A&gt;! &lt;BR /&gt;Glad to hear that was helpful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;So, backing to your new problem, i'd kindly ask to you, to open a new question in HCC (cause separating different issues helps other HCC user to search for a specific problem) &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;But, just lemme get better into your problem, the query listed isn't working? If so, does Nifi showing error? Or just the result isn't the expected? &lt;BR /&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 01:18:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Please-help-me-to-get-count-of-particular-field-value-in/m-p/223852#M79663</guid>
      <dc:creator>vmurakami</dc:creator>
      <dc:date>2018-06-21T01:18:42Z</dc:date>
    </item>
  </channel>
</rss>

