logstash file json absolute path
input {
file {
path => "/home/kimjh/Desktop/ela.dir/query_/n.json"
type => "json"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
ruby {
code => 'event.set("numCheck", "numberGood")'
}
}
output {
stdout {
codec => rubydebug
}
}
'ELK > logstash' 카테고리의 다른 글
logstash jdbc mssql output (0) | 2020.07.04 |
---|---|
logstash eve_odd (0) | 2020.06.17 |
logstash input-plugin (elasticsearch) (0) | 2020.05.12 |
logstash plugin install (0) | 2020.04.15 |
logstash + app-search (0) | 2019.12.10 |
네이버 python 지식인 답변
'언어 > python' 카테고리의 다른 글
pandas + matplotlib 을 이용하여 tistory 방문 관련 pie 차트 그리기 (0) | 2020.08.04 |
---|---|
코로나 데이터 수집 (파이썬) (0) | 2020.07.18 |
21대 국회의원 선거 크롤링 (0) | 2020.04.15 |
pdf 변환 (0) | 2019.12.18 |
python으로 pdf 파일 read (0) | 2019.12.08 |
ruby elasticsearch client
require 'elasticsearch/transport'
require 'elasticsearch'
client = Elasticsearch::Client.new hosts: [
{ host: '',
port: 9200,
user: "",
password: ""
}
]
#client.index index: 'myindex', type: 'mytype', id: 1, body: { title: 'Test' }
response = client.search index: 'myindex', body: { query: { match: { title: 'test' } } }
puts response["hits"]["hits"][0]["_source"]
require | import |
'언어 > Ruby' 카테고리의 다른 글
ruby json 파일 읽기 (0) | 2020.07.02 |
---|---|
ruby + elasticsearch indices/ health (0) | 2020.07.02 |
cea(ver3) (0) | 2016.02.27 |
class (0) | 2016.02.27 |
루비(ruby)상속 -> 상속 -> 상속 (0) | 2016.02.26 |
라즈베리파이 온도습도 센서
import time
import Adafruit_DHT
class Temp():
def __init__(self):
self.temperPin = 4
self.sensor = Adafruit_DHT.DHT11
def getMyRoomTemp(self):
try:
#
# =================================================================
while True:
h, t = Adafruit_DHT.read_retry (self.sensor,self.temperPin)
if h is not None and t is not None:
print("Temperature = {0:0.1f}*C Humidity = {1:0.1f}%".format(t, h))
else:
print("Read Error !!")
time.sleep(100)
# =================================================================
#
except KeyboardInterrupt as e:
print(e)
finally:
print("end")
if __name__ == "__main__":
o = Temp()
o.getMyRoomTemp()
'arduino_' 카테고리의 다른 글
라즈베리파이 led (0) | 2020.05.18 |
---|---|
four led ver2 (0) | 2017.10.10 |
LED _VER2 FOUR (0) | 2017.10.10 |
four led (0) | 2017.10.10 |
sds011 - 먼지 센서 (0) | 2017.09.21 |
라즈베리파이 led
from RPi import GPIO
import time
class LED():
def __init__(self):
GPIO.setmode(GPIO.BOARD)
self.ledRed = 11
def pinSetup(self):
GPIO.setup(self.ledRed, GPIO.OUT, initial=GPIO.LOW)
def pinOn(self):
try:
while True:
try:
# ===================
# led on !!
# ===================
GPIO.output (self.ledRed, GPIO.HIGH)
except:
print("led on error !!")
beak
else:
time.sleep(0.5)
print("redPing on!!")
try:
# ===================
# led off !!
# ===================
GPIO.output (self.ledRed, GPIO.LOW)
except:
print("led off error !!")
break
else:
time.sleep(0.5)
print("redPing off!!")
except KeyboardInterrupt as e:
print(e)
pass
GPIO.cleanup()
print("cleanup !!")
############################
# program main function
# writer : JunHyeon.kim
############################
if __name__ == "__main__":
o = LED()
o.pinSetup()
o.pinOn()
'arduino_' 카테고리의 다른 글
라즈베리파이 온도습도 센서 (0) | 2020.05.18 |
---|---|
four led ver2 (0) | 2017.10.10 |
LED _VER2 FOUR (0) | 2017.10.10 |
four led (0) | 2017.10.10 |
sds011 - 먼지 센서 (0) | 2017.09.21 |
logstash input-plugin (elasticsearch)
$ ./logstash-plugin install logstash-input-elasticsearch
Validating logstash-input-elasticsearch
Installing logstash-input-elasticsearch
Installation successful
input {
elasticsearch {
hosts => ["http://x.x.x.x:9200"]
index => "number_"
query => '{"query": {"match_all": {}}}'
docinfo => true
}
}
filter {
mutate {
remove_field => ["@version", "@timestamp"]
}
}
output {
file {
path => "/home/kim/Desktop/elastic/l-762/conf/result.json"
codec => "json_lines"
}
}
'ELK > logstash' 카테고리의 다른 글
logstash eve_odd (0) | 2020.06.17 |
---|---|
logstash file json absolute path (0) | 2020.06.17 |
logstash plugin install (0) | 2020.04.15 |
logstash + app-search (0) | 2019.12.10 |
logstash + python (0) | 2019.01.12 |
3노드 클러스터 엘라스틱서치 ( elasticsearch 3node)
셋팅 관련 자료가 너무 없어서 혼자서 삽질하면서 익힌게 생각이 난다. 누군가에게 도움이 되었으면 한다.
( 물리서버가 1대인 경우 사실 이와 같은 환경은 위험이 따른다. 만약 물리서버가 죽게되면 cluster를 잃게 된다. )
물리서버 : ubuntu 20/04
작업 전 port 개방 ( root 사용자로 작업할 것 )
- centos
firewall-cmd --zone=public --permanent --add-port=9200/tcp |
firewall-cmd --reload |
- ubuntu
ufw allow 9200 ufw allow 9300 ufw allow 5601 |
elasticsearch 디렉토리 구조
서비스가 정상적으로 올라 왔는지 확인
방법1) $ ps -ef | grep elasticsearch
방법2) $ jps
4629 Elasticsearch
4935 Elasticsearch
7419 Jps
5087 Elasticsearch
[ 단 jps 명령어 사용시에는 openjdk 설치가 반드시 필요하다 ]
방법3) $ curl -XGET http://localhost:9200/_cluster/health?pretty
kibana 설정
브라우저에서
: http://xxx.xxx.xxx.xxx:5601로 접근 시도한다.
'ELK > elasticsearch' 카테고리의 다른 글
elasticsearch match-query (0) | 2020.12.23 |
---|---|
elasticsearch term query (0) | 2020.12.22 |
elasticsearch index mapping 에 관한 생각 (0) | 2020.04.17 |
logstash ruby syntax (0) | 2020.04.14 |
logstash file stdin (0) | 2020.04.14 |
크롤링 대상
전략
1] ul.section_list_ranking > li > a 의 구조
2] a tag에 title 속성에서 값을 get 하자
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
class Cwl {
String target_url;
Cwl() {
this.target_url = "https://news.naver.com/main/main.nhn?mode=LSD&mid=shm&sid1=101";
}
public void requestUrl() throws IOException {
Document doc = Jsoup.connect(this.target_url).get();
Element element = doc.selectFirst("ul.section_list_ranking");
Elements elements = element.select("li > a");
for (Element e : elements) {
System.out.println(e.attr("title"));
}
}
}
public class stu01 extends Cwl{
public static void main(String[] args) throws IOException {
Cwl cwl_object = new Cwl();
cwl_object.requestUrl();
} // end of main function
}
결과
'언어 > java' 카테고리의 다른 글
java + elasticsearch highlevel rest api (0) | 2020.07.04 |
---|---|
정올 1523 (9) (0) | 2020.05.06 |
정올 1338번문제 (8일차) (2) | 2020.05.03 |
1314 정올 (7-2) (0) | 2020.05.02 |
1307 정올 7일차 (0) | 2020.05.02 |
정올 1523 (9)
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=795&sca=2020
class Triangle {
public int height;
public int kind_choice;
Triangle() {
this.height = 0;
this.kind_choice = 0;
}
public void kind1() {
// kind _1
for (int i = 1; i <= this.height; i++) {
// 높이
for (int j = 1; j <= i; j++) {
// 별
System.out.print("*");
}
System.out.println();
}
} // end of kind1 function
public void kind2() {
// kind _2
for (int i = 1; i <= this.height; i++) {
// 높이
for (int j = this.height; j >= i; j--) {
// 별
System.out.print("*");
}
System.out.println();
}
} // end of kind2 function
public void kind3() {
// kind _3
for (int i = 1; i <= this.height; i++) {
// 높이
for (int m = i; m < this.height; m++) {
// 공백
System.out.print(" ");
}
for (int j = 1; j <= 2*i-1; j++) {
// 별
System.out.print("*");
}
// 개행
System.out.println();
}
} // end of kind2 function
}
'언어 > java' 카테고리의 다른 글
java + elasticsearch highlevel rest api (0) | 2020.07.04 |
---|---|
java 크롤링 (0) | 2020.05.09 |
정올 1338번문제 (8일차) (2) | 2020.05.03 |
1314 정올 (7-2) (0) | 2020.05.02 |
1307 정올 7일차 (0) | 2020.05.02 |
정올 1338번문제 (8일차)
가장 않좋은 main 함수에 다 때려박기 코드 ㅋㅋㅋ
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=2074&sca=20
import java.util.Scanner;
public class Jung1338 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
char [][] numArry;
int size = 0;
size = input.nextInt();
numArry= new char[size][size];
int n =0;
int m =size-1;
int s = (int)'A';
int tmp_n = 0;
int tmp_m = 0;
while (n != size) {
tmp_n = n;
tmp_m = m;
while (tmp_n != size) {
numArry[tmp_n][tmp_m] = (char) s;
tmp_n += 1;
tmp_m -= 1;
s += 1;
}
n += 1;
}
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
System.out.printf("%c", numArry[i][j]);
if ( j != size-1) {
System.out.print(" ");
}
}
System.out.println();
}
}
}
'언어 > java' 카테고리의 다른 글
java 크롤링 (0) | 2020.05.09 |
---|---|
정올 1523 (9) (0) | 2020.05.06 |
1314 정올 (7-2) (0) | 2020.05.02 |
1307 정올 7일차 (0) | 2020.05.02 |
정올 1430 (6일차) (0) | 2020.04.30 |