이렇게 탄성 적층을 설정했습니다. 필자는 사용자 정의 인덱스 이름을 사용하여 Filebeat 및 Topbeat를 통해 로그 및 최상위 데이터를 전달하려고합니다.Logstash가 Filebeat 및 Packetbeat에 대한 올바른 색인을 작성하지 않음
비록 Logstash가 사용자 지정 인덱스 이름과 함께 전달하는 데이터에 대한 인덱스를 만들지는 않지만.
Logstash의 설정 :
input{
beats{
port => 27080
congestion_threshold => 1500
}
jmx {
path => "file://Machine01/Users/username/projects/Logstash/logstash/bin/jmx"
polling_frequency => 15
type => "jmx"
nb_thread => 4
}
}
filter {
if [type] == "Type1"{
grok{
break_on_match => false
patterns_dir => ["C:\Users\users\projects\Logstash\logstash\bin\patterns"]
match => { "message" => "%{YEAR:Year}%{MONTHNUM:Month}%{MONTHDAY:Day} %{HOUR:Hour}%{MINUTE:Minute}%{SECOND:Second} %{LogLevel:LogVerbosity} %{MODULE:MODULENAME}%{SPACE}%{MESSAGEID:MESSAGEID} %{SUBMODULE:SUBMODULE} %{MESSAGE:MESSAGE}"}
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
add_tag => ["Groked"]
}
if "_grokparsefailure" in [tags] {
drop { }
}
if [type] == "jmx" {
if ("OperatingSystem.ProcessCpuLoad" in [metric_path] or "OperatingSystem.SystemCpuLoad" in [metric_path]) {
ruby {
code => "event['cpuLoad'] = event['metric_value_number'] * 100"
add_tag => [ "cpuLoad" ]
}
}
}
}
}
output {
if [type] == "jmx" {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "jmx-%{+YYYY.MM.dd}"
}
} else {
elasticsearch {
hosts => ["http://localhost:9200"]
manage_template => true
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
if [type] == "dbtable" {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "dbtable-%{+YYYY.MM.dd}"
}
}
}
}
Filebeat의 설정 : 내가 index: custom
를 설정할 때, 그것은 "사용자 정의-YYYY.MM.DD"로 Elasticsearch에 인덱스를 생성해야합니다 기대하고
filebeat:
prospectors:
- paths:
- test.log
input_type: log
tail_files: false
scan_frequency: 3s
backoff: 20s
backoff_factor: 1
document_type: custom
registry:
fields:
type: custom
spool_size: 10000
idle_timeout: 2s
output:
logstash:
index: custom
hosts: ["valid hostname"]
logging:
to_files: true
files:
path: ./
name: filebeat.log
rotateeverybytes: 10485760
level: debug
. 그러나 Elasticsearch에서 "%{[@metadata][beat]}-%{+YYYY.MM.dd}
"으로 색인을 생성하는 것입니다.
내가 #index: custom
이라고 대답하면 Elasticsearch에 색인이 filebeat-YYYY.MM.dd
으로 생성됩니다.
내가 잘못 가고 있는데 왜 사용자 정의 색인 패턴에서 작동하지 않습니까?