# Logstash input: Twitter

**URL:** <https://discuss.elastic.co/t/logstash-input-twitter/298351>\
**Category:** Logstash\
**Created:** [February 27, 2022, 9:00am UTC](https://discuss.elastic.co/t/logstash-input-twitter/298351 "2022-02-27T09:00:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rysiu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rysiu/32/61919_2.png) [@Rysiu](https://discuss.elastic.co/u/Rysiu)\
**Post date:** [February 27, 2022, 9:00am UTC](https://discuss.elastic.co/t/logstash-input-twitter/298351/1 "2022-02-27T09:00:56Z")

</div>

Hello,

I have a simple pipeline setup in Logstash (keys changed of course):

```auto
input {
        twitter {
                consumer_key => "rcLfXIhprrPKLgVI467Slbux0"
                consumer_secret =>"uYk68znfoDQq70lfWXS3IxscHOffQWzZK5nkpbeE3D9ue9JDOd"
                oauth_token => "1292007035622632472-91pHS6gKnwfCAKKVuKughJb2L12lDF"
                oauth_token_secret => "BSeK1qyEEGtocP4omiqu7KxPj4Ie8ufpG6zTdZS3BxFnH"
                keywords => ["union"]
                languages=> ["en"]
                full_tweet => true
                ignore_retweets => true
        }
}

output {
        elasticsearch {
                hosts => ["https://node000.elk.int:9200"]
                cacert => '/etc/logstash/certs/ca.crt'
                user => 'userrrr'
                password => 'passssssss'

                manage_template => false
                index => "twitter"
        }
}

```

Unfortunately Logstash returns an error:

```auto
[2022-02-27T09:38:28,378][WARN][logstash.inputs.twitter][twitter][96a78dc08f18a92c07b1f152323c5e9d5b90690fbc8d9873cf01d05bf7d7c373] Twitter client error {:message=>"", :exception=>Twitter::Error::Forbidden, :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/twitter-6.2.0/lib/twitter/streaming/response.rb:24:in `on_headers_complete'", "org/ruby_http_parser/RubyHttpParser.java:370:in `<<'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/twitter-6.2.0/lib/twitter/streaming/response.rb:19:in `<<'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/twitter-6.2.0/lib/twitter/streaming/connection.rb:20:in `stream'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/twitter-6.2.0/lib/twitter/streaming/client.rb:119:in `request'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/twitter-6.2.0/lib/twitter/streaming/client.rb:38:in `filter'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-twitter-4.0.3/lib/logstash/inputs/twitter.rb:151:in `do_run'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-twitter-4.0.3/lib/logstash/inputs/twitter.rb:131:in `run'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:405:in `inputworker'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:396:in `block in start_input'"], :options=>nil}

```

The _ **Forbidden** _ error indicates some problem with the _endpoint_ (?).  
Information for Forbidden error? [Twitter API Response Codes & Error Support | Twitter Developer Platform](https://developer.twitter.com/en/support/twitter-api/error-troubleshooting)

Probably the problem is the "Callback URI / Redirect URL" item in the Twitter API configuration (webiste: [developer.twitter.com](http://developer.twitter.com)).

![image](https://us1.discourse-cdn.com/elastic/original/3X/5/9/59eaf5311060b27981028045c9e3fe8898ad61d8.png)

The Callback URI / Redirect URL field is required.

Where could the problem be?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [February 27, 2022, 2:42pm UTC](https://discuss.elastic.co/t/logstash-input-twitter/298351/2 "2022-02-27T14:42:32Z")

</div>

I'm not sure this input still works, the Twitter API changed and the gem used by this input was not updated to be compatible with the new version.

If your Access Key is for the Twitter API V2, then this is the issue, check this [github issue](https://github.com/logstash-plugins/logstash-input-twitter/issues/73) about it.

Unless the gem is updated or a new input is built, you won't be able to use the twitter input with the new twitter API.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 27, 2022, 2:43pm UTC](https://discuss.elastic.co/t/logstash-input-twitter/298351/3 "2022-03-27T14:43:01Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
