<?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: Splunk GUI Rest API Twitter Integration in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95840#M6595</link>
    <description>&lt;P&gt;There really is nothing more for me to add at this point.As you can see from the above screenshot I can not replicate this on any of my environments (multiple OS's and versions of Splunk). I will continue polling for 24 hrs and re-observe.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Oct 2013 04:46:13 GMT</pubDate>
    <dc:creator>Damien_Dallimor</dc:creator>
    <dc:date>2013-10-30T04:46:13Z</dc:date>
    <item>
      <title>Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95810#M6565</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;We are looking use the Splunk REST gui to connect to Twitter and monitor feeds based on several URL parameters we care to search for.&lt;/P&gt;

&lt;P&gt;We have the end point defined as &lt;A href="https://api.twitter.com/1.1/search/tweets.json"&gt;https://api.twitter.com/1.1/search/tweets.json&lt;/A&gt;, have our authentication credentials entered, and for a sample URL Argument as q=UPMC to search twitter anything for UPMC returning in XML format. There is no data returning though but when I use this twitter dev app it works fine: &lt;A href="https://dev.twitter.com/console"&gt;https://dev.twitter.com/console&lt;/A&gt;. Anyone else having issue using the GUI Rest integration or have a better way to pull in twitter data based on keywords? Should we worry about defining Response Handler and other options in the config?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2013 19:45:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95810#M6565</guid>
      <dc:creator>aaronkorn</dc:creator>
      <dc:date>2013-10-11T19:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95811#M6566</link>
      <description>&lt;P&gt;Can you post your inputs.conf stanza for the Twitter Rest Input that is not working for you.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2013 23:35:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95811#M6566</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2013-10-11T23:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95812#M6567</link>
      <description>&lt;P&gt;Thanks for your response. Heres what we have so far:&lt;/P&gt;

&lt;P&gt;[rest://Twitter]&lt;BR /&gt;
auth_type = oauth1&lt;BR /&gt;
endpoint = &lt;A href="https://api.twitter.com/1.1/search/tweets.json" target="_blank"&gt;https://api.twitter.com/1.1/search/tweets.json&lt;/A&gt;&lt;BR /&gt;
http_method = GET&lt;BR /&gt;
index = twitter&lt;BR /&gt;
index_error_response_codes = 1&lt;BR /&gt;
oauth1_access_token = 1951974925-0Gmoi6JxxToMG4P7lEWX03xxxxxxxxxxxxxx&lt;BR /&gt;
oauth1_access_token_secret = sYDyjNRz71Q0Wbbeni0RbuBoIQmUxxxxxxxxxxxxx&lt;BR /&gt;
oauth1_client_key = vpIKhXBmLmqxxxxxxxxxxx&lt;BR /&gt;
oauth1_client_secret = 0Vrp1WeP7g8NGewlTx2pMKcxxxxxxxxxxxxx&lt;BR /&gt;
response_type = xml&lt;BR /&gt;
sourcetype = twitter&lt;BR /&gt;
streaming_request = 0&lt;BR /&gt;
url_args = q=UPMC&lt;BR /&gt;
polling_interval = 10&lt;BR /&gt;
response_handler_args =&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:57:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95812#M6567</guid>
      <dc:creator>aaronkorn</dc:creator>
      <dc:date>2020-09-28T14:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95813#M6568</link>
      <description>&lt;P&gt;One of the issues may be that you have response_type set to xml, albeit you're pulling json data.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2013 17:48:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95813#M6568</guid>
      <dc:creator>polifagbonanza</dc:creator>
      <dc:date>2013-10-13T17:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95814#M6569</link>
      <description>&lt;P&gt;Looks ok , I have the same setup in my twitter test stanza and it works..what search are you using ? try searching over "all time" for "index=twitter sourcetype=twitter"&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2013 18:21:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95814#M6569</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2013-10-13T18:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95815#M6570</link>
      <description>&lt;P&gt;Thanks, I did that and it is only returning 1 event but when I search twitter.com/search for that query (UPMC) I get multiple results back. What would be the best way to leverage a real time stream for the keywords or only search for the most recent tweets?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2013 13:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95815#M6570</guid>
      <dc:creator>aaronkorn</dc:creator>
      <dc:date>2013-10-14T13:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95816#M6571</link>
      <description>&lt;P&gt;Well, you will be getting multiple events in the response document , but they are being indexed in Splunk as 1 single event. That is why the REST API Modular Input has Custom Response Handlers that you can plug in to parse the specific response you are getting back ie: split out the individual twitter events from the JSON response.&lt;BR /&gt;
You add your custom response handler to bin/responsehandlers.py and declare it on the setup page for your REST Input Definition&lt;/P&gt;

&lt;P&gt;Here is an example of what a custom handler might look like for the Twitter JSON response :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;class TwitterEventHandler:

    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)
            last_tweet_indexed_id = 0
            for twitter_event in output["statuses"]:
                print_xml_stream(json.dumps(twitter_event))
                if "id_str" in twitter_event:
                    tweet_id = twitter_event["id_str"]
                    if tweet_id &amp;gt; last_tweet_indexed_id:
                        last_tweet_indexed_id = tweet_id

            if not "params" in req_args:
                req_args["params"] = {}

            req_args["params"]["since_id"] = last_tweet_indexed_id

        else:
            print_xml_stream(raw_response_output)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I see that the raw response back from twitter also has a &lt;STRONG&gt;created_at&lt;/STRONG&gt; field for each event , which you can then use as your Splunk index time value.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2013 07:08:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95816#M6571</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2013-10-16T07:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95817#M6572</link>
      <description>&lt;P&gt;Thanks! This seems to be working pretty well now but we seem to be ingesting duplicate tweets every time it executes the API call. Is there anyway around this? I know in there are several different parameters to pass though in the request (can be found here: &lt;A href="https://dev.twitter.com/docs/api/1.1/get/search/tweets"&gt;https://dev.twitter.com/docs/api/1.1/get/search/tweets&lt;/A&gt;). I imagine that we would want to use the since_id but how would you update this value in the call based off the last ingested event?&lt;/P&gt;</description>
      <pubDate>Sun, 20 Oct 2013 00:24:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95817#M6572</guid>
      <dc:creator>aaronkorn</dc:creator>
      <dc:date>2013-10-20T00:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95818#M6573</link>
      <description>&lt;P&gt;Maintain a variable in responsehandlers.py that stores the last tweet id , and then use this as the since_id for your next request.And iteratively repeat this.&lt;/P&gt;

&lt;P&gt;More advanced , but you could potentially also use the Splunk Python SDK from the response handler to execute a Splunk search and ask it for the latest tweet id that you indexed to use as your since_id.&lt;/P&gt;

&lt;P&gt;Also , you can update your REST stanza "url_args" using the Python SDK , so if you needed to persist the since_id value back into you configuration (ie: to survive restarts), then you can do this also.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:01:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95818#M6573</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2020-09-28T15:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95819#M6574</link>
      <description>&lt;P&gt;Ok. Where should we start in the responsehandlers.py script? I guess I'm not fully understanding the purpose of the responsehandlers.py file and how we would go about passing this to the inputs.conf file.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2013 19:57:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95819#M6574</guid>
      <dc:creator>aaronkorn</dc:creator>
      <dc:date>2013-10-21T19:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95820#M6575</link>
      <description>&lt;P&gt;The REST Mod Input is generic , it can be used in an unknown number of scenarios , so I have to provide an extension mechanism for handling specific behaviours. This is the purpose of responsehandlers.py.So custom handling can also extend beyond output formatting to also being dynamically calculating URL arguments to add to the request.Such as the "since_id" argument which you need to calculate based on the latest tweet id that you processed.1 suggested 2 ways of performing this above , simple and more advanced.Updated above untested code snippet to show how this might potentially be done.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2013 03:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95820#M6575</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2013-10-22T03:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95821#M6576</link>
      <description>&lt;P&gt;Awesome! Just had to modify it slightly for the different id. Thanks for all your help&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2013 19:44:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95821#M6576</guid>
      <dc:creator>aaronkorn</dc:creator>
      <dc:date>2013-10-22T19:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95822#M6577</link>
      <description>&lt;P&gt;id_str instead of id&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2013 19:45:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95822#M6577</guid>
      <dc:creator>aaronkorn</dc:creator>
      <dc:date>2013-10-22T19:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95823#M6578</link>
      <description>&lt;P&gt;Nice. Updated the code example.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2013 20:49:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95823#M6578</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2013-10-22T20:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95824#M6579</link>
      <description>&lt;P&gt;So I thought this was working but it isnt. But it is close! Whenever we say "req_args["params"]["since_id"] = last_tweet_indexed_id" do we need to set this anywhere else or will it automatically be passed into the url parameter list? Or does since_id need to be added to the response handles arguments in the REST GUI?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:03:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95824#M6579</guid>
      <dc:creator>aaronkorn</dc:creator>
      <dc:date>2020-09-28T15:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95825#M6580</link>
      <description>&lt;P&gt;It is automatically passed into the url parameter list.&lt;BR /&gt;
Trace back through the code in rest.py (the while loop at line 422) to see how this happens.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2013 19:26:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95825#M6580</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2013-10-23T19:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95826#M6581</link>
      <description>&lt;P&gt;I have the similar  setting but getting below mentioned error in my splunkd.log, has anyone encountered this?&lt;/P&gt;

&lt;P&gt;10-23-2013 11:30:00.231 +1300 ERROR ExecProcessor - message from "python /app/splunk/etc/apps/rest_ta/bin/rest.py" Exception performing request: [Errno 8] _ssl.c:521: EOF occurred in violation of protocol&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2013 22:31:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95826#M6581</guid>
      <dc:creator>saad_siddiqi</dc:creator>
      <dc:date>2013-10-23T22:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95827#M6582</link>
      <description>&lt;P&gt;Note : I just uploaded a new version of the REST Modular Input that now automatically persists any dynamically calculated URL arguments back into your inputs.conf stanzas (using the Splunk Python SDK).So if you restart the REST Modular Input stanza , it starts polling from where it last left off.I tested this all with the "TwitterEventHandler" (now included in version 1.3) and it worked perfectly for me.&lt;/P&gt;

&lt;P&gt;Below is the intial stanza that I started with.&lt;/P&gt;

&lt;P&gt;On each subsequent polling iteration, the url_args field gets dynamically updated with the latest tweet id as the since_id value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[rest://twitter]
auth_type = oauth1
endpoint = https://api.twitter.com/1.1/search/tweets.json
http_method = GET
index = main
index_error_response_codes = 1
oauth1_access_token = 217362964-dtJVxxxxxxxxxUOY4Q0w
oauth1_access_token_secret = BWQ2LcQhxxxxxxxxxxxlf4o1B84mWrlE
oauth1_client_key = xYj5UxxxxxxxxxxxxOP97Q
oauth1_client_secret = LDdy4VoxxxxxxxxxxxxxxAI1HtlKU
polling_interval = 30
response_handler = TwitterEventHandler
response_type = json
sourcetype = rest_twitter
streaming_request = 0
url_args = q=music,since_id=0
disabled = 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After the first polling, the since_id has now incremented :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[rest://twitter]
auth_type = oauth1
endpoint = https://api.twitter.com/1.1/search/tweets.json
http_method = GET
index = main
index_error_response_codes = 1
oauth1_access_token = 217362964-dtJVxxxxxxxxxUOY4Q0w
oauth1_access_token_secret = BWQ2LcQhxxxxxxxxxxxlf4o1B84mWrlE
oauth1_client_key = xYj5UxxxxxxxxxxxxOP97Q
oauth1_client_secret = LDdy4VoxxxxxxxxxxxxxxAI1HtlKU
polling_interval = 30
response_handler = TwitterEventHandler
response_type = json
sourcetype = rest_twitter
streaming_request = 0
url_args = q=music,since_id=393287846443753472
disabled = 0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:03:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95827#M6582</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2020-09-28T15:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95828#M6583</link>
      <description>&lt;P&gt;This is awesome! Thank you for the update. I notice that the since_id parameter is changing but we still seem to be ingesting duplicate tweets. Any idea what it could be?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2013 14:50:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95828#M6583</guid>
      <dc:creator>aaronkorn</dc:creator>
      <dc:date>2013-10-24T14:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk GUI Rest API Twitter Integration</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95829#M6584</link>
      <description>&lt;P&gt;I dont see this.What search are you using to determine this ?&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2013 18:55:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-GUI-Rest-API-Twitter-Integration/m-p/95829#M6584</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2013-10-24T18:55:15Z</dc:date>
    </item>
  </channel>
</rss>

