<?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 use Custom Response Handlers for monitoring REST service to check for an XML element or JSON value in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177843#M10998</link>
    <description>&lt;P&gt;I had a look and see nothing relevant, who can help me resolve this issue?&lt;BR /&gt;
I'm evaluating this product so would need to understand why the response is not even being logged for this particular request.&lt;/P&gt;</description>
    <pubDate>Fri, 01 May 2015 13:00:16 GMT</pubDate>
    <dc:creator>rubans</dc:creator>
    <dc:date>2015-05-01T13:00:16Z</dc:date>
    <item>
      <title>How to use Custom Response Handlers for monitoring REST service to check for an XML element or JSON value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177839#M10994</link>
      <description>&lt;P&gt;For e.g:&lt;BR /&gt;
For the following response how do I check XML or JSON for a status &amp;amp; succeeded elements/props (also never used python so any example would help):&lt;BR /&gt;
XML:&lt;/P&gt;

&lt;P&gt;FIN_UK_TB_AVAILABLE&lt;BR /&gt;
2015-03-06&lt;BR /&gt;
2015-03-26T11:02:43.905Z&lt;BR /&gt;
Success&lt;BR /&gt;
true&lt;/P&gt;

&lt;P&gt;MAJOR&lt;BR /&gt;
2015-03-06T12:00:00.000Z&lt;/P&gt;

&lt;P&gt;JSON:&lt;BR /&gt;
{&lt;BR /&gt;
  "_id": "2015-03-06_FIN_UK_TB_AVAILABLE",&lt;BR /&gt;
  "event": "FIN_UK_TB_AVAILABLE",&lt;BR /&gt;
  "date": "2015-03-06T00:00:00.000Z",&lt;BR /&gt;
  "raised": "2015-03-26T11:02:43.905Z",&lt;BR /&gt;
  "status": "Success",&lt;BR /&gt;
  "succeeded": true,&lt;BR /&gt;
  "states": [],&lt;BR /&gt;
  "escalations": [&lt;BR /&gt;
    {&lt;BR /&gt;
      "path": "MAJOR",&lt;BR /&gt;
      "date": "2015-03-06T12:00:00.000Z"&lt;BR /&gt;
    }&lt;BR /&gt;
  ],&lt;BR /&gt;
  "dependencies": [],&lt;BR /&gt;
  "_updateCount": 1,&lt;BR /&gt;
  "_created": "2015-03-26T08:20:24.979Z"&lt;BR /&gt;
}&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:47:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177839#M10994</guid>
      <dc:creator>rubans</dc:creator>
      <dc:date>2020-09-28T19:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Custom Response Handlers for monitoring REST service to check for an XML element or JSON value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177840#M10995</link>
      <description>&lt;P&gt;I presume you are referring to this app : &lt;A href="https://splunkbase.splunk.com/app/1546/" target="_blank"&gt;https://splunkbase.splunk.com/app/1546/&lt;/A&gt; ?&lt;/P&gt;

&lt;P&gt;If so , there are a bunch of example response handlers here for processing JSON repsonses :&lt;/P&gt;

&lt;P&gt;&lt;A href="https://github.com/damiendallimore/SplunkModularInputsPythonFramework/blob/master/implementations/rest/bin/responsehandlers.py" target="_blank"&gt;https://github.com/damiendallimore/SplunkModularInputsPythonFramework/blob/master/implementations/rest/bin/responsehandlers.py&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;1) write your custom handler and add it to SPLUNK_HOME/rest_ta/bin/responsehandlers.py&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;class SomeCustomHandler:

    def __init__(self,**args):
        pass

    def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):       

        if response_type == "json":        
            output = json.loads(raw_response_output)

            #get the status and succeeded attributes from the json response
            status = output["status"]
            succeeded = output["succeeded"]

            #presumably then use them for some sort of boolean logic

            #output json event to Splunk
            print_xml_stream(json.dumps(output))

        else:
            print_xml_stream(raw_response_output)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) declare this custom handler in your stanza setup&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/34842-screen+shot+2015-04-30+at+8.11.29+pm.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:43:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177840#M10995</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2020-09-28T19:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Custom Response Handlers for monitoring REST service to check for an XML element or JSON value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177841#M10996</link>
      <description>&lt;P&gt;Ok, it seems now the Splunk is not even logging the request/response for the JSON content.&lt;BR /&gt;
I don't see any entries in my search results for the expected data point.&lt;BR /&gt;
When the response is :&lt;BR /&gt;
896487&lt;/P&gt;

&lt;P&gt;This is logged in search results&lt;/P&gt;

&lt;P&gt;However, when the response is:&lt;/P&gt;

&lt;P&gt;FIN_UK_TB_AVAILABLE&lt;BR /&gt;
2015-03-06&lt;BR /&gt;
2015-03-26T11:02:43.905Z&lt;BR /&gt;
Success&lt;BR /&gt;
true&lt;/P&gt;

&lt;P&gt;FIN_UK_CURRENT_TB&lt;BR /&gt;
batchId&lt;BR /&gt;
55196a640cf2dafa21580e27&lt;/P&gt;

&lt;P&gt;FIN_UK_CURRENT_TB&lt;BR /&gt;
rowCount&lt;BR /&gt;
316400&lt;/P&gt;

&lt;P&gt;FIN_UK_CURRENT_TB&lt;BR /&gt;
checksum&lt;BR /&gt;
52336917775281.00&lt;/P&gt;

&lt;P&gt;FIN_UK_PRIOR_TB&lt;BR /&gt;
batchId&lt;BR /&gt;
551985b80cf2dafa21580e29&lt;/P&gt;

&lt;P&gt;FIN_UK_PRIOR_TB&lt;BR /&gt;
priorStatus&lt;BR /&gt;
Open&lt;/P&gt;

&lt;P&gt;FIN_UK_PRIOR_TB&lt;BR /&gt;
rowCount&lt;BR /&gt;
149366&lt;/P&gt;

&lt;P&gt;FIN_UK_PRIOR_TB&lt;BR /&gt;
checksum&lt;BR /&gt;
24119627122230.60&lt;/P&gt;

&lt;P&gt;MAJOR&lt;BR /&gt;
2015-03-06T12:00:00.000Z&lt;/P&gt;

&lt;P&gt;It's not being logged&lt;BR /&gt;
I don't see any errors in Splunk System monitor associated with this either.&lt;BR /&gt;
It seems to be very inconsistent, is there something it doesn't like about response from the REST service that may stop logging the result?&lt;BR /&gt;
This is before I have even applied the Custom Handler.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:48:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177841#M10996</guid>
      <dc:creator>rubans</dc:creator>
      <dc:date>2020-09-28T19:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Custom Response Handlers for monitoring REST service to check for an XML element or JSON value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177842#M10997</link>
      <description>&lt;P&gt;I just gave you a generic example to point you in the right direction. I know nothing about your REST endpoint , JSON payload or the logic you are trying to apply to the JSON response.&lt;BR /&gt;
So, the intent was to give you a  example which you could then build something off.&lt;/P&gt;

&lt;P&gt;Any errors will be searchable in Splunk with : index=_internal ExecProcessor error rest.py&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2015 11:42:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177842#M10997</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2015-05-01T11:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Custom Response Handlers for monitoring REST service to check for an XML element or JSON value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177843#M10998</link>
      <description>&lt;P&gt;I had a look and see nothing relevant, who can help me resolve this issue?&lt;BR /&gt;
I'm evaluating this product so would need to understand why the response is not even being logged for this particular request.&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2015 13:00:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177843#M10998</guid>
      <dc:creator>rubans</dc:creator>
      <dc:date>2015-05-01T13:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Custom Response Handlers for monitoring REST service to check for an XML element or JSON value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177844#M10999</link>
      <description>&lt;P&gt;It doesn't seem to monitor the url as expected, either that or it's not logging the result.&lt;BR /&gt;
Can you let me know how I can look into this issue or provide the customer service number?&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2015 15:22:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177844#M10999</guid>
      <dc:creator>rubans</dc:creator>
      <dc:date>2015-05-01T15:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Custom Response Handlers for monitoring REST service to check for an XML element or JSON value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177845#M11000</link>
      <description>&lt;P&gt;OK  , lets do troubleshooting 101....&lt;/P&gt;

&lt;P&gt;1) can you see the request hitting your server (logs) ?&lt;BR /&gt;
2) can you see the request on the wire (wireshark is useful) ? &lt;BR /&gt;
3) what is your REST config on the Splunk side (look at inputs.conf with basic shell searching)&lt;BR /&gt;
4) any firewalls ?&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2015 17:38:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177845#M11000</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2015-05-01T17:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Custom Response Handlers for monitoring REST service to check for an XML element or JSON value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177846#M11001</link>
      <description>&lt;P&gt;HI Damien,&lt;BR /&gt;
1&amp;amp; 2) Yes I can see both type of requests/responses using wireshark every 60 seconds as expected&lt;BR /&gt;
3)Can you provide more detail? what kind of scripting? I don't see any inputs.conf file in the C:\Program Files\Splunk\etc\apps\rest_ta folder.&lt;BR /&gt;
4)I don't think firewall should be an issue as I can see the responses coming back and also I can see the logging as mentioned for one response in Splunky (both HTTP endpoints are being served from the same Host domain)&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2015 11:08:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177846#M11001</guid>
      <dc:creator>rubans</dc:creator>
      <dc:date>2015-05-06T11:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Custom Response Handlers for monitoring REST service to check for an XML element or JSON value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177847#M11002</link>
      <description>&lt;P&gt;1) Go to SPLUNK_HOME/etc/apps and do a filesystem search under this directory  for the stanza you setup for your REST Input , it gets saved to a file names inputs.conf  , and then post this stanza for me to look at ?&lt;/P&gt;

&lt;P&gt;2) Have you written a custom response handler ? what does this code look like ? Maybe you have an error in your code ?&lt;/P&gt;

&lt;P&gt;3) When you search for events in Splunk , how are you searching for them ? Search command , time range etc.. ?&lt;/P&gt;</description>
      <pubDate>Sat, 09 May 2015 04:38:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-Custom-Response-Handlers-for-monitoring-REST-service/m-p/177847#M11002</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2015-05-09T04:38:32Z</dc:date>
    </item>
  </channel>
</rss>

