Skip to content

Instantly share code, notes, and snippets.

@ereshzealous
Created June 28, 2021 12:20
Show Gist options
  • Save ereshzealous/33a7cfa7040d9fbed0b0acf62cd0273e to your computer and use it in GitHub Desktop.
Save ereshzealous/33a7cfa7040d9fbed0b0acf62cd0273e to your computer and use it in GitHub Desktop.
input {
kafka{
codec => json
bootstrap_servers => "localhost:9092"
topics => ["elastic-test"]
}
}
filter {
mutate {
add_field => {
"id" => "%{[data][id]}"
}
add_field => {
"firstName" => "%{[data][firstName]}"
}
add_field => {
"lastName" => "%{[data][lastName]}"
}
add_field => {
"city" => "%{[data][city]}"
}
add_field => {
"country" => "%{[data][country]}"
}
add_field => {
"email" => "%{[data][email]}"
}
add_field => {
"phoneNumber" => "%{[data][phoneNumber]}"
}
add_field => {
"createdAt" => "%{[data][createdAt]}"
}
remove_field => ["data", "@version", "@timestamp", "message", "event", "globalId"]
}
}
output {
stdout {
codec => json_lines
}
elasticsearch {
hosts => ["localhost:9200"]
index => "kafka_test"
document_id => "%{id}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment