GithubHelp home page GithubHelp logo

twitterheatmaps's Introduction

Generating Twitter Heatmaps using ELK Stack and NodeJS

This is a "How To" on generating a live heat-map of tweets sent within the U.S.A using the ELK Stack(Elasticsearch,Logstash,Kibana) and NodeJS. See below for the screenshot of the final product of this guide.

Directory Structure:

/Documents
|-- /elasticsearch
|    | -- /bin
|           | -- elasticsearch.bat
|-- /kibana
|    | -- /bin
|           | -- kibana.bat
|-- /logstash
|    | -- /bin
|           | -- logstash.bat
|-- /filebeats
|    | -- filebeat.exe
|    | -- filebeat.yml
|
|-- /TwitterHeatmaps
|    | -- server.js
|    | -- nodetwit.conf
|    | -- filebeat.yml

Getting Started:

Prerequisites

Installing

Deployment

  1. Replace the ./filebeat->filebeat.yml with filebeat.yml

  2. Update the server.js file with your Twitter API credentials:

  consumer_key:         '',
  consumer_secret:      '',
  access_token:         '',
  access_token_secret:  '',
  timeout_ms:           60*1000,  // optional HTTP request timeout to apply to all requests.
})
  1. Open 4 Powershell terminals, run the following commands:

    • C:\: .\Documents\elasticsearch-5.6.2\bin\elasticsearch
    • C:\: .\Documents\kibana-5.6.3-windows-x86\bin\kibana.bat
    • C:\: .\Documents\logstash-5.6.3\bin\logstash -f .\Documents\TwitterHeatmaps\twitter_heatmaps_logstash.conf
    • C:\: .\Documents\filebeat-5.6.4-windows-x86_64\filebeat.exe -e -c .\Documents\filebeat-5.6.4-windows-x86_64\filebeat.yml
  2. Configure the Index in Kibana:

  • Go to <localhost:5601> in your browser

  • Click "Management"

  • Enter 'twittermaps' as the index pattern

  • Click "Create"

alt text

  1. Create the object in Elasticsearch:

  • Click "Dev Tools"
  • Paste the JSON object in the console,highlight the code,click "Play"
PUT twittermaps
{
  "mappings": {
    "locality": {
      "properties": {
          "location": {
          "type": "geo_point"
          }
      }
    }
  }
}


alt text

  1. Open a new Terminal or Powershell Window, Go to the TwitterHeatmaps Directory and run: node server.js

  2. In Kibana, click "Discover". You should be able to see the logs input.

  • Under "Available Fields" hover over "location" and click "Add"
  • Once "location" is added to "Selected Fields" click "Visualize" (We are almost there!!!)

alt text

  1. Create the visualization:

  • In the "Options" select "Map Type" heatmap
  • Click "Play", you should see a heatmap appear
  • You can save this visualization and add it to a Dashboard.
  • Your visualization should look like the one below:

alt text

The End.

twitterheatmaps's People

Contributors

mkbru avatar mkbrutd avatar natalysheinin avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

twitterheatmaps's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.