자전거 여행 (중동 => 선유도 => 중동)

안양천

사실 이 사진은 집으로 복귀할 때 찍은 사진이다. 갈때는 가기 바뻐서 사진을 못찍었는데 복귀할 때 찍었다. 기억에 반대편에 신도림 역이 있었던 걸로 기억한다.

운동 1도 안하다가 갑자기 20km 를 쉬지 않고 달렸더니 편의점 도착하니까 다리가 후덜덜 하더라 ㅋㅋ





코로나 데이터 수집 (파이썬)
#주말 토이프로젝트
1] 수집 사이트
https://news.google.com/covid19/map?hl=ko&mid=%2Fm%2F02j71&gl=KR&ceid=KR%3Ako
코로나바이러스(코로나19) - Google 뉴스
Google 뉴스에서 코로나19의 영향을 받는 지역에 관한 지도, 통계, 뉴스를 확인하세요.
news.google.com
2] 그래프
: 사용그래프 (altair)
참고 : https://partrita.github.io/posts/altair/


그래프 view source

vega-editor

값 수정 테스트
3] 코드 깃
https://github.com/sleep4725/Cor19
sleep4725/Cor19
Contribute to sleep4725/Cor19 development by creating an account on GitHub.
github.com
'언어 > python' 카테고리의 다른 글
# 기초 dictionary (0) | 2020.08.21 |
---|---|
pandas + matplotlib 을 이용하여 tistory 방문 관련 pie 차트 그리기 (0) | 2020.08.04 |
네이버 python 지식인 답변 (0) | 2020.06.06 |
21대 국회의원 선거 크롤링 (0) | 2020.04.15 |
pdf 변환 (0) | 2019.12.18 |
logstash ruby 활용법
전체 코드
require 'elasticsearch'
class EsTest
attr_accessor :esClient, :action_array
def initialize
@esClient = Elasticsearch::Client.new
@action_array = Array.new
end
def totalIndex
## 전체 인덱스 조회
response = esClient.cat.indices
if ! response.nil?
totalIndex = response.split("\n")
totalIndex.each_with_index do |datas,index|
index_name = datas.split(" ")[2]
if index_name.chars.first != "."
## document가 몇개 인지 확인___________________________________________________________
total_doc_count = esClient.count index: index_name, body: {query: {match_all:{}}}
puts " nu: #{index}"
action_array.push({"index"=> {"_index"=> "my_total_index","_id"=> index,"data"=> {"index_name"=> index_name,"index_count"=> total_doc_count["count"]}}})
end
end # end of totalIndex each
esClient.bulk body: action_array
end # end of nil?
end
end
def register(params)
@es = EsTest.new
end
def filter(event)
event.set("work_time", Time.now.strftime("%Y%m%d"))
if event.get("result") != "es server access error"
@es.totalIndex
return [event]
else
return [event]
end
end

생성자
: ruby 에서 생성자는 initialize 이름의 함수로 사용된다.
=> @esClient : elasticsearch 인스턴스
=> @action_array : Array 인스턴스 ( 코드상에서 bulk 구조로 데이터를 insert 하기 위해 선언된 부분 )
=================================================================

1) esClient.cat.indices 는 전체 인덱스의 목록을 리턴해준다.
2) response.nil 은 해당 변수가 null 값인지를 물어보는 부분이다.
3) split 은 문자열을 특정 문자를 기준으로 자르게 된다. ( 자르고 리턴된 값은 Array 이다. )

4) each_with_index 는 python 에서 enumerate 하고 동일
=================================================================

1) .chars.first 는 문자열에서 첫번째 문자 즉 인덱스에서 0 에 위치에 시작하는 값이다.
'ELK > logstash' 카테고리의 다른 글
event 처리 (0) | 2020.12.22 |
---|---|
특정 필드의 값 변경 (0) | 2020.11.30 |
logstash jdbc mssql output (0) | 2020.07.04 |
logstash eve_odd (0) | 2020.06.17 |
logstash file json absolute path (0) | 2020.06.17 |