Twitter input for mentioned Hashtag


#1

HI All,

i am using twitter lagstash input configuration to pull data from twitter.
i used below configuration file to pull data.

input {
twitter {
consumer_key => "XXXXXXXXXXXXXXX"
consumer_secret => "XXXXXXXXXXXX"
oauth_token => "XXXXXXXXXXXXXXXXXXXX"
oauth_token_secret => "XXXXXXXXXXXXXXXXXXX"
keywords => ["pepsi"]
full_tweet => true

}

filter {
tracks => "pepsi"
language => "en"
}

output {
elasticsearch{
protocol => "http"
document_id => "%{id}"
host => "localhost"
index => "twitter2"
index_type => "tweet"
}
}

But i am getting error.I need data from pepsi hashtag.

Please guide me to get data from mentioned hashtag.

Thanks,
Dinesh


(Mark Walkom) #2

What error are you getting?


#3

HI Warkolm,

I am getting below error...

E:\ELK3\logstash-1.5.3\bin>set java_home=C:\Program Files\Java\jdk1.8.0_51

E:\ELK3\logstash-1.5.3\bin>logstash agent --debug -f twitter-simple.conf
io/console not supported; tty will not be manipulated
←[36mReading config file {:file=>"/ELK3/logstash-1.5.3/vendor/bundle/jruby/1.9/gems/logstash-core-1.5.3-java/lib/logstash/agent.rb", :level=>:debug, :line=>"309", :method=>"local_config"}←[0m
Error: Expected one of #, => at line 18, column 14 (byte 426) after input {
twitter {
consumer_key => "XXXXXXXXXXXXXXXXXXXXXXXXX"
consumer_secret => "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
oauth_token => "XXXXXXXXXXXXXXXXXXXXX"
oauth_token_secret => "XXXXXXXXXXXXXX"
keywords => ["pepsi"]
full_tweet => true

}

filter {
tracks => "pepsi"
language => "en"
}

output {
elasticsearch
You may be interested in the '--configtest' flag which you can
use to validate logstash's configuration before you choose
to restart a running system.

E:\ELK3\logstash-1.5.3\bin>

Thanks,
Dinesh


(Mark Walkom) #4

Ok figures, that's not a valid config for the twitter input, take a look at https://www.elastic.co/guide/en/logstash/current/plugins-inputs-twitter.html


#5

Hi Warkolm,

Thanks for your quick reply.

It is working fine if i don't mention any filter in config file.

But i am looking for data from particular hashtag("pepsi").So i provided tracks in filter.

If You think it's not work Please give me a solution for the same.

Thanks,
Dinesh.


(Mark Walkom) #6

As mentioned, read the docs, you will see that the filter you have is not valid, and what you can do to filter by those hashtags.


#7

I am trying to do analysis that particular hashtag to find the sum of the followers from different country's and some kind of sentiment analysis.


(system) #8