1
몇 가지 매우 유사한 섹션을 사용하여 Logstash 파일 입력을 구성했습니다 (아래 참조). 보시다시피, 섹션은 거의 동일합니다. "_application"및 "_appPath"변수가 다르며 나머지는 동일합니다. 따라서 Logstash 입력 섹션을 매개 변수화하는 방법이 있는지 궁금해합니다. 따라서 하나의 "파일"매개 변수 그룹 만 설명 할 수 있지만 아래에 표시된 것처럼 여러 개의 "파일"섹션 인스턴스가 생성됩니다.Logstash 입력 섹션을 매개 변수화 할 수 있습니까?
input {
file {
add_field => { "_environment" => "#{Octopus.Environment.Name}" }
add_field => { "_application" => "potion" }
add_field => { "_appPath" => "#{Octopus.Tentacle.Agent.ApplicationDirectoryPath}/%{[_environment]}/Potion" }
path => "%{[_appPath]}/logs/log.*.txt"
sincedb_path => "%{[_appPath]}/logs/sincedb"
codec => "json"
tags => [potion, local]
start_position => "beginning"
}
file {
add_field => { "_environment" => "#{Octopus.Environment.Name}" }
add_field => { "_application" => "bridge_soap" }
add_field => { "_appPath" => "#{Octopus.Tentacle.Agent.ApplicationDirectoryPath}/%{[_environment]}/Bridge.Web" }
path => "%{[_appPath]}/logs/log.*.txt"
sincedb_path => "%{[_appPath]}/logs/sincedb"
codec => json
tags => [bridge_soap, local]
start_position => "beginning"
}
file {
add_field => { "_environment" => "#{Octopus.Environment.Name}" }
add_field => { "_application" => "bridge_rest" }
add_field => { "_appPath" => "#{Octopus.Tentacle.Agent.ApplicationDirectoryPath}/%{[_environment]}/Bridge.Rest.Host" }
path => "%{[_appPath]}/logs/log.*.txt"
sincedb_path => "%{[_appPath]}/logs/sincedb"
codec => json
tags => [bridge_rest, local]
start_position => "beginning"
}
}
답변 해 주셔서 감사합니다. –