본문 바로가기

전체 글

(262)
Logstash에서 SQS, Elasticsearch로 데이터가 들어가지 않을 때 [상황] 로그를 수집하는 과정에서 예상보다 굉장히 많은 로그가 Logstash에서 수집되어 SQS로 보내졌고, 그 과정에서 오버헤드가 생겨 SQS에서 제대로 처리할 수 없었다. [에러 메시지] - 로그스태시 [WARN ] 2022-01-05 23:00:52.337 [[main]"test_queue", :exception=>Seahorse::Client::NetworkingError, :message=>"Connection refused - Failed to open TCP connection to sqs.ap-northeast-2.amazonaws.com:443 (Connection refused - connect(2) for \"sqs.ap-northeast-2.amazonaws.com\" port 4..
Logstash nested json, json in json parsing error 부제 : 로그스태시에서 잘 되던 metric log가 갑자기 이상하게 파싱이 안 될때. { \"system\": { \"cpu\": { \"core\":4, \"cpuPct\":, \"loadavg1\":0.18, \"loadavg5\":0.23, \"loadavg15\":0.25 }, \"mem\": { \"total\":7624.00, \"used\":3731.00, \"free\":3894.00, \"memPct\":48.94 }, \"disk\": { \"total\":51188.00, \"used\":16209.00, \"free\":34980.00, \"diskPct\":32 } } 메트릭 로그는 이런 형태이다. 해결 : 1. 오류메시지 잘 보기. :exception=>#
Logstash 7.16.2 버전에서 로그 파싱하기 {"svctype":"test-svc-type","instance_name":"test-instance_ip-0.0.0.0", "@timestamp":"2021-12-30T12:30:06.731Z","environment":"test","role":"api","filename":"test.log","@version":"1","message":"* 2021-12-30 21:30:06,690 test log message","host":"ip-0.0.0.0.ap-northeast-2.compute.internal","team":"test"} 위와 같은 로그가 있다. 각 서버에서 위와 같은 로그를 받아와, 로그스태시에 input 형태로 넣고, SQS로 아웃풋을 보낸다. 중요한 것은 설정 파일에서 input {..
Kubernetes에서 Logstash(sqs output)를 사용해 elasticsearch, kibana로 로그 확인 1. Hombrew를 사용하여 logstash 설치 brew tap elastic/tap brew cask install homebrew/cask-versions/adoptopenjdk8 brew install elastic/tap/logstash-full 로그스태시가 최신버전으로 설치된다. 2. 폴더 생성 후 conf 파일 생성 input { file { path => "/usr/share/logstash/data/*.log" codec => "json" } } output { stdout { } sqs { access_key_id => "***" secret_access_key => "****" codec => "json" queue => "test_queue" region => "ap-northea..
버터나이프크루 3기 활동, 빅시스터 회고 버터나이프 크루? 빅시스터? 왜 하게 되었나? 어떻게 했나? 하는 중 애로사항은? 하면서 좋았던 점은? 하면서 아쉬웠던 점은? 내년에 도전할 팀에게 한 마디! 버터나이프 크루? 여성가족부에서 후원하는 버터나이프 크루는 만 19세-34세 청년으로 구성된 3명 이상의 팀이 성평등한 변화의 흐름을 만들어나갈 수 있는 주제로 활동하면 최대 600만 원의 사업비를 지원하는 프로젝트입니다. 이번 연도에는 4월 말-5월 초까지 모집했으니, 관심 있으신 분이라면 2022년에 한 번 체크해 보시길. (성평등한 변화의 흐름..이라는 말이 애매한데, 여성이라는 이유로 받았던 차별을 조금씩 부술 수 있는 프로젝트라면 되지 않을까 싶습니다.) 다만 버터나이프크루에 선정된 아이템으로는 추후 다른 사업에 지원하기 어렵다고 하니, ..
쉘스크립트로 슬랙 메시지 보내는 방법 1. 먼저 앱을 만든다. https://api.slack.com/start/overview#creating An introduction to the Slack platform Slack apps and workflows extend, expand, and automate your Slack workspace. Cultivate conversation, inspire action, and integrate services by building an app or workflow. api.slack.com 2. Settings-Basic informations-하단의 App level token을 눌러 토큰을 생성한다. 3. 쉘스크립트를 작성한다. 채널 ID는 채널 이름을 클릭 후 하단부를 보면 알 수 있다...
pid가 동작하는 중인지 확인하는 방법 FIND=`ssh -n -p $port $ip find ${PATH} -name "*.[파일형식]"` if [ -n "${FIND}" ]; then PREV_PID=`ssh -n -p $port $usr@$ip cat ${FIND}` # pid #74535 CHECK_STAT=`ssh -n -p $port $usr@$ip ps -f ${PREV_PID} | awk 'NR == 2 {print $7}'` # bash: /proc/74535: 파일이 존재하고 디렉토리인 경우 echo "${target} CHECK_STAT : "${CHECK_STAT}"" # pid 문자열이 존재하고 pid의 STAT이 D, T, X, Z 로 시작하지 않고 STAT이 공백이 아니면 # STAT : D -> 입출력 대기로 깨울..
gcp jupyter notebook에서 url 사용하여 xml 파일 파싱하기 How to parse xml file in gcp jupyter notebook with url import xml.etree.ElementTree as ET import urllib.request def parsefile(path): response = urllib.request.urlopen(path).read() tree = ET.fromstring(response) print(tree) time = tree.findall("event") starttime = [x.findtext("starttime") for x in time] duration = [x.findtext("duration") for x in time] if len(startlist) >= 2: starttime = int(star..