Twitter input plugin

  • Plugin version: v3.0.8
  • Released on: 2018-04-06
  • Changelog

For other versions, see theVersioned plugin docs.

Getting Help

For questions about the plugin, open a topic in the Discuss forums. For bugs or feature requests, open an issue in Github.For the list of Elastic supported plugins, please consult the Elastic Support Matrix.

Description

Ingest events from the Twitter Streaming API.

Twitter Input Configuration Options

This plugin supports the following configuration options plus the Common Options described later.

Also see Common Options for a list of options supported by allinput plugins.

 

consumer_key

  • This is a required setting.
  • Value type is string
  • There is no default value for this setting.

Your Twitter App’s consumer key

Don’t know what this is? You need to create an "application"on Twitter, see this url: https://dev.twitter.com/apps/new

consumer_secret

  • This is a required setting.
  • Value type is password
  • There is no default value for this setting.

Your Twitter App’s consumer secret

If you don’t have one of these, you can create one byregistering a new application with Twitter:https://dev.twitter.com/apps/new

follows

  • Value type is array
  • There is no default value for this setting.

A comma separated list of user IDs, indicating the users toreturn statuses for in the Twitter stream.See https://developer.twitter.com/en/docs/tweets/filter-realtime/guides/basic-stream-parametersfor more details.

full_tweet

  • Value type is boolean
  • Default value is false

Record full tweet object as given to us by the Twitter Streaming API.

ignore_retweets

  • Value type is boolean
  • Default value is false

Lets you ignore the retweets coming out of the Twitter API. Default ⇒ false

keywords

  • Value type is array
  • There is no default value for this setting.

Any keywords to track in the Twitter stream. For multiple keywords, usethe syntax ["foo", "bar"]. There’s a logical OR between each keywordstring listed and a logical AND between words separated by spaces perkeyword string.See https://dev.twitter.com/streaming/overview/request-parameters#trackfor more details.

The wildcard "*" option is not supported. To ingest a sample stream ofall tweets, the use_samples option is recommended.

languages

  • Value type is array
  • There is no default value for this setting.

A list of BCP 47 language identifiers corresponding to any of the languages listedon Twitter’s advanced search page will only return tweets that have been detectedas being written in the specified languages.

locations

  • Value type is string
  • There is no default value for this setting.

A comma-separated list of longitude, latitude pairs specifying a setof bounding boxes to filter tweets by.See https://dev.twitter.com/streaming/overview/request-parameters#locationsfor more details.

oauth_token

  • This is a required setting.
  • Value type is string
  • There is no default value for this setting.

Your oauth token.

To get this, login to Twitter with whatever account you want,then visit https://dev.twitter.com/apps

Click on your app (used with the consumer_key and consumer_secret settings)Then at the bottom of the page, click Create my access token whichwill create an oauth token and secret bound to your account and thatapplication.

oauth_token_secret

  • This is a required setting.
  • Value type is password
  • There is no default value for this setting.

Your oauth token secret.

To get this, login to Twitter with whatever account you want,then visit https://dev.twitter.com/apps

Click on your app (used with the consumer_key and consumer_secret settings)Then at the bottom of the page, click Create my access token whichwill create an oauth token and secret bound to your account and thatapplication.

proxy_address

  • Value type is string
  • Default value is "127.0.0.1"

Location of the proxy, by default the same machine as the one running this LS instance

proxy_port

  • Value type is number
  • Default value is 3128

Port where the proxy is listening, by default 3128 (squid)

rate_limit_reset_in

  • Value type is number
  • Default value is 300

Duration in seconds to wait before retrying a connection when twitter responds with a 429 TooManyRequestsIn some cases the x-rate-limit-reset header is not set in the response and <error>.rate_limit.reset_inis nil. If this occurs then we use the integer specified here. The default is 5 minutes.

use_proxy

  • Value type is boolean
  • Default value is false

When to use a proxy to handle the connections

use_samples

  • Value type is boolean
  • Default value is false

Returns a small random sample of all public statuses. The tweets returnedby the default access level are the same, so if two different clients connectto this endpoint, they will see the same tweets. If set to true, the keywords,follows, locations, and languages options will be ignored. Default ⇒ false

Common Options

The following configuration options are supported by all input plugins:

Setting Input type Required

add_field

hash

No

codec

codec

No

enable_metric

boolean

No

id

string

No

tags

array

No

type

string

No

Details

 

add_field

  • Value type is hash
  • Default value is {}

Add a field to an event

codec

  • Value type is codec
  • Default value is "plain"

The codec used for input data. Input codecs are a convenient method for decoding your data before it enters the input, without needing a separate filter in your Logstash pipeline.

enable_metric

  • Value type is boolean
  • Default value is true

Disable or enable metric logging for this specific plugin instanceby default we record all the metrics we can, but you can disable metrics collectionfor a specific plugin.

id

  • Value type is string
  • There is no default value for this setting.

Add a unique ID to the plugin configuration. If no ID is specified, Logstash will generate one.It is strongly recommended to set this ID in your configuration. This is particularly usefulwhen you have two or more plugins of the same type, for example, if you have 2 twitter inputs.Adding a named ID in this case will help in monitoring Logstash when using the monitoring APIs.

input {  twitter {    id => "my_plugin_id"  }}

tags

  • Value type is array
  • There is no default value for this setting.

Add any number of arbitrary tags to your event.

This can help with processing later.

type

  • Value type is string
  • There is no default value for this setting.

Add a type field to all events handled by this input.

Types are used mainly for filter activation.

The type is stored as part of the event itself, so you canalso use the type to search for it in Kibana.

If you try to set a type on an event that already has one (forexample when you send an event from a shipper to an indexer) thena new input will not override the existing type. A type set atthe shipper stays with that event for its life evenwhen sent to another Logstash server.