[
https://issues.apache.org/jira/browse/AMBARI-17306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337391#comment-15337391
]
Swapan Shridhar edited comment on AMBARI-17306 at 6/18/16 1:15 AM:
-------------------------------------------------------------------
So, for *CASE A*, check for filtering is as follows :
- the current line to be : *"{"*, and
- next line to be *""amInfo" : {"*
- And last line to be *"}"*
OR
for *CASE B*, check for filtering is as follows:
- the current line to be : *"{"*, and
- next line to be *"state" :*
- And next to next line to be *"}"* and line is the last one.
To figure out the start of JSON output.
was (Author: swapanshridhar):
So, for *CASE A*, check for filtering is as follows :
- the current line to be : *"{"*, and
- next line to be *""amInfo" : {"*
- And last line to be *"}"*
OR
for *CASE B*, check for filtering is as follows:
- the current line to be : *"{"*, and
- next line to be *"state" :*
- And next to next line to be *"}"* and line is the last one.
To figure out the start of JSON output.
> Filter out MOTD logging from 'llapstatus' command in order to get the output
> which is JSON parsable.
> ----------------------------------------------------------------------------------------------------
>
> Key: AMBARI-17306
> URL: https://issues.apache.org/jira/browse/AMBARI-17306
> Project: Ambari
> Issue Type: Bug
> Components: ambari-server
> Affects Versions: 2.4.0
> Reporter: Swapan Shridhar
> Assignee: Swapan Shridhar
> Fix For: 2.4.0
>
>
> Example of expected response which can be JSON parsed:
> *CASE A:*
> {code}
> {
> "amInfo" : {
> "appName" : "llap0",
> "appType" : "org-apache-slider",
> "appId" : "application_1466036628595_0010",
> "containerId" : "container_1466036628595_0010_01_000001",
> "hostname" : "ts-hs2ia-0615-r-2.openstacklocal",
> "amWebUrl" : "http://ts-hs2ia-0615-r-2.openstacklocal:60865/"
> },
> "state" : "LAUNCHING",
> "originalConfigurationPath" :
> "hdfs://ts-hs2ia-0615-r-5.openstacklocal:8020/user/hive/.slider/cluster/llap0/snapshot",
> "generatedConfigurationPath" :
> "hdfs://ts-hs2ia-0615-r-5.openstacklocal:8020/user/hive/.slider/cluster/llap0/generated",
> "desiredInstances" : 1,
> "liveInstances" : 0,
> "appStartTime" : 1466123287309
> }
> {code}
> The same output with MOTD message:
> {code}
> This is MOTD message
> This is MOTD message1
> {
> "amInfo" : {
> "appName" : "llap0",
> "appType" : "org-apache-slider",
> "appId" : "application_1466036628595_0010",
> "containerId" : "container_1466036628595_0010_01_000001",
> "hostname" : "ts-hs2ia-0615-r-2.openstacklocal",
> "amWebUrl" : "http://ts-hs2ia-0615-r-2.openstacklocal:60865/"
> },
> "state" : "LAUNCHING",
> "originalConfigurationPath" :
> "hdfs://ts-hs2ia-0615-r-5.openstacklocal:8020/user/hive/.slider/cluster/llap0/snapshot",
> "generatedConfigurationPath" :
> "hdfs://ts-hs2ia-0615-r-5.openstacklocal:8020/user/hive/.slider/cluster/llap0/generated",
> "desiredInstances" : 1,
> "liveInstances" : 0,
> "appStartTime" : 1466123287309
> }
> {code}
> Other scenario can be (eg: APP_NOTFOUND):
> *CASE B:*
> {code}
> This is MOTD message
> This is MOTD message1
> {
> "state" : "APP_NOT_FOUND"
> }
> {code}
> - We need to filter out extra lines initially added on top of JSON parseable
> string.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)