본문 바로가기
프로그래밍/ELK

logstash로 'file' 수집하기

by 뽀도 2020. 10. 12.

logstash config의 input/ output 부분 수정하면 file을 수집하여 elasticsearch로 보낼 수 있다. 

 

ex) 

input {
  file {
   path=>"D:/TestFilePath/textlog.txt"
   start_position => "beginning"
   type => textfile
  }
}

filter {
  #...
}

output {
  if [type] == "textfile" {
		elasticsearch {
			hosts => ["http://localhost:9200","http://localhost:9200"]
			manage_template => false
			index => "textfile-index"
	  }
  }
}

 

[작성시 주의]

 

1. input {

  path => 부분에 \랑 / 주의 

  type => " " 쓰지 않음 

}

 

2. output 

{

  if [type]에 " " 써야 함

}

 

 

 

반응형

댓글