input {
stdin{
}
elasticsearch {
hosts => ["http://127.0.0.1:9200"]
user => "admin"
index => "user_info"
password => "admin"
docinfo => true
}
}
filter{
mutate {
remove_field => ["@version"] #去除版本号
}
mutate{
add_field => ["typeCode","%{[@metadata][_type]}"] #type替换成typeCode
}
}
output {
elasticsearch {
hosts => ["http://127.0.0.2:9200"]
user => elastic
password => elastic
index => "user_info"
#document_type => "%{[@metadata][_type]}"
#document_id => "%{[@metadata][_id]}"
}
stdout {
codec => json_lines
}
}