일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- OPCUA
- node.js
- query
- CSV
- path.data
- grok
- kibana
- Crontab
- typescript
- Data Engineering
- windows
- 7.7.1
- elastic
- logstash
- devtools
- json
- framework
- filebeat
- venv
- airflow
- ubuntu
- elasticsearch
- dense_vector
- ELK
- package.json
- KoA
- Tutorial
- PYTHON
- configure
- DSL
- Today
- Total
목록logstash (15)
Gibbs Kim's playground
Elasticsearch Cloud로 데이터를 구축 시, 기존 ES (On-premise)에서 데이터를 가져와야하는 경우가 발생합니다. 이때 로그스태시를 활용하여 데이터를 적재할 수 있습니다. input { elasticsearch { hosts => "localhost:9200" index => "local_idx" query => '{ "query": { "match_all": {} } }' } } filter { } output { elasticsearch { cloud_id => "Deploy명:Key값" cloud_auth => "elastic:패스워드" ssl => true index => "cloud_idx" } } 기존 서버에서 구동중인 ES (On-premise)의 인덱스명을 'local..
SQL DB의 데이터를 Elasticsearch로 인덱싱하려고 할때 logstash conf 파일을 어떻게 설정하는지에 대한 내용을 작성합니다. == SQL DB (MariaDB) 예시 == | == 테이블 (TEST_TABLE) 예시 == PORT : 1234 | NO | ID | CODE_NAME DB Name : test User : test_user PWD : 1234 Table명 : TEST_TABLE ============ Logstash conf 파일 작성내용입니다. input { jdbc { jdbc_connection_string => "jdbc:mysql://localhost:1234/test?characterEncoding=UTF-8&serverTimezone=UTC" jdbc_dri..
일반적으로 Logstash에서 파일을 인덱싱하게 되면 ELK 7.0 이상 버전에서는 shard 가 1의 값을 디폴트로 가진다 (6.x 이하 버전은 shard 개수 5가 디폴트) 만약 어떤 인덱스가 ES에 적재된 후, shard 개수를 변경하려면 _reindex로 새 인덱스를 생성하는 것 말고는 답이 없다. 그래서 아예, 인덱싱 전에 템플릿을 작성하여 샤드를 조정할 수 있는 기능을 ES에서 제공한다. 다음을 보자. (참고 : https://www.elastic.co/guide/en/elasticsearch/reference/6.4/indices-templates.html) # curl -X PUT "localhost:9200/_template/template_1?pretty" -H 'Content-Type..
다음과 같은 vector data 파일이 있다고 하자. [ 1.2, 1.3, 1.4, 1.5 ] 일반적인 JSON 형태가 아니므로, Logstash에서 접근할만한 방법으로는 multiline codec을 생각해볼 수 있다. input{ path => "FILE_PATH" start_position => "beginning" sincedb_path => "/dev/null" codec => multiline { pattern => "^\\n" negate => true what => "previous" auto_flush_interval => 1 } } 이것을 기반으로 바로 인덱싱을 수행해보았으나 Doc가 생성되지 않았다. 그래서 쿼리로 인덱스를 생성하고, vector 타입을 가지는 필드를 매핑한 후 Lo..
웹크롤링등을 하여 다음과 같은 패턴의 텍스트 파일이 있다고 하자. 이렇게 막 써대 ... ... 이때, HTML TAG를 제외한 내용을 엘라스틱서치에 인덱싱하고 싶다면 다음과 같이 .conf 파일을 작성해보자 ### It is operated on ELK 7.7.1 input{ file{ path => "WANTED_FILE_PATH" ## you should write your own file or dir path start_position => "beginning" sincedb_path => "/dev/null" ## above two lines, based on linux OS codec => multiline { pattern => "^\\n" negate => true what => "prev..
Logstash 파일의 경로가 다음과 같다고 하자. /A/B/C/D/E/sample.json 이때, 특정 필드(ex: test)에 sample이라는 문자열만 삽입하고 싶으면 다음과 같은 grok 패턴을 사용하자. %{GREEDYDATA}/%{GREEDYDATA:test}\.json
.json 파일을 엘라스틱서치에 인덱싱하면 보통 "message" 필드에 중괄호( { } ) 내부에 있던 내용들이 저장된다. 이때 "key:value" 쌍이나 기타 값들을 적절하게 분류하여 필드와 데이터로 분류하고 싶다면 filter를 사용하게 되는데 Logstash에서는 보통 Grok filter를 통해 분류 작업을 수행한다. [참고 링크] https://github.com/elastic/logstash/blob/v1.4.2/patterns/grok-patterns elastic/logstash Logstash - transport and process your logs, events, or other data - elastic/logstash github.com https://grokdebug.her..
로그스태시로 데이터를 인덱싱할때 주로 다음과 같은 명령어를 사용한다. ## If file name of .conf is test.conf, typing like below. LOGSTASH_HOME/bin> ./logstash -f test.conf 이때 다음과 같은 에러가 발생할 수 있다. > Logstash could not be started because there is already another instance using the configured data directly. If you wish to run multiple instances, you must change the "path.data" setting. 의미는 대략, 데이터를 인덱싱하기에 이미 다른 instance가 사용중이라는 건..
elasticsearch, logstash, kibana를 설치하여 실행할 때는 일반적으로 커맨드를 통한 수동접속(manual connection)을 기본으로 한다. 하지만, 상황상 백그라운드에서 계속 실행을 시켜야 하는 경우가 있는데 다음과 같은 명령어를 통해 해결가능하다. ## Elasticsearch 실행하기 nohup $ES_HOME/bin/elasticsearch & ## Logstash 실행하기 nohup $LOGSTASH_HOME/bin/logstash -f test.conf & ## Kibana 실행하기 nohup $KIBANA_HOME/bin/kibana & # 실행 프로세스 확인하기 ps -ef | grep SOMETHING ### options on SOMETHING ''' 1) no..

ELK에서, 특히 Logstash를 사용하려고 하면 jdk가 필요하다. wget을 사용하여 JDK를 다운로드하는 방법을 알아보자. wget 'https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz' - ~/apps/openjdk-11.0.2_linux-x64_bin.tar.gz Java Path 설정