GithubHelp home page GithubHelp logo

elastic-demo's Introduction

#엘라스틱서치 데모 데이터 생성기

이 프로젝트를 내려받은 후 프로젝트 홈 디렉토리에서 npm install 실행.

npm install

1. 서울시 지하철 유동인원 데이터

대시보드

1.1 ELK 설정

elasticsearch

  • 인덱스명: demo-kr-subway
  • 타입명: kr-subway
  • 매핑 정보:
필드명 타입 설명
time_slice datetime 승/하차 시간. 1시간 단위.
line_num string 호선 (1호선, 2호선 ...)
station_name string 역 이름
station_code string 역 코드
station_geo { lat , lon } geo_point 역 좌표
people_in integer 승차인원
people_out integer 하차인원
total integer 승하차인원 합계
  • 매핑 정보 입력:
curl -XPUT '<host url>:[9200|9243]/demo-kr-subway' [-u '<user>'] -d '
{
  "mappings" : {
    "kr-subway" : {
      "properties" : {
        "time_slice" : { "type" : "date" },
        "line_num" : { "type" : "string", "index" : "not_analyzed" },
        "station_name" : { "type" : "string", "index" : "not_analyzed" },
        "station_code" : { "type" : "string", "index" : "not_analyzed" },
        "station_geo" : { "type" : "geo_point" },
        "people_in" : { "type" : "integer" },
        "people_out" : { "type" : "integer" },
        "people_out" : { "type" : "integer" }
      }
    }
  }
}'
  • ES 서버에 Sield 가 설치된 경우 -u 'user' 추가해서 사용자 인증 해야 함.

logstash

  • logstash.conf:
input {
  file {
    codec => json
    path => "<git project path>/elastic-demo/data/*.log"
  }
}

filter{
  mutate {
    remove_field => [ "@version", "@timestamp", "host", "path" ]
  }
}

output{
  elasticsearch{
#    protocol => "node"
#    protocol => "http"
#    ssl => true
    host => "<host url>"  #remove http|https
#    port => 9300
    port => 9243
    index => "demo-kr-subway"
    document_type => "kr-subway"
#    user => "<user>"        #need admin privilege
#    password => "<password>"
  }
}
  • found 클라우드 서비스에서 ssl 접속을 사용하는 경우 protocol => "http" 만 사용 가능함.
  • ES 서버에 Sield 가 설치된 경우 user => "user", password => "password" 추가해서 사용자 인증 해야 함.

1.2 데이터 수집

서울시의 지하철은 각각 14호선은 서울메트로가, 58호선은 서울도시철도공사가 관리하기 별도 파일들로부터 데이터를 추출해야 한다.

  • 전체 도큐먼트 수 : 2,188,564

역 코드로 지하철역 위치 조회

역별 시간대별 승하차 인원 현황(2014년) - 1~4호선

  • 설명: 2014년도 1~4호선 역별 시간대별 승하차 인원.
  • 제공: 서울메트로
  • 방법:
    • http://www.seoulmetro.co.kr/board/bbs/view.action?bbsCd=61&mCode=C080000000&idxId=18450 접속.
    • 1~4호선 역별 시간대별(일) 승하차인원 2014 - Excel 파일 다운로드.
    • Excel 파일 열어서 다른이름으로 저장 선택 후 csv 형식으로 저장.
    • 저장한 csv 파일을 다시 윈도우 메모장으로 열어서 UTF-8 포맷으로 선택 후 새로 저장.
    • 파일명을 2014_1TO4.csv 로 변경 후 프로젝트의 source/ 디렉토리 아래로 이동.
    • 다음 명령어 실행하면 프로젝트의 data/ 디렉토리 아래에 1to4_{YYYYMMDD}.log 형식으로 파일 생성됨.
node bin/1to4_convert.js

역별 시간대별(일) 승하차 인원[2014] - 5~8호선 서울도시철도공사

node bin/5to8_convert.js

1.3 Kibana4 예제 페이지

elastic-demo's People

Contributors

kimjmin avatar

Watchers

James Cloos avatar Hyunseok Cho avatar

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.