Skip to content

Instantly share code, notes, and snippets.

@i-amolo
Forked from ereshzealous/kafka_input.conf
Created May 16, 2023 23:49
Show Gist options
  • Save i-amolo/5a62443b5db1efe53afbbe96fc71306b to your computer and use it in GitHub Desktop.
Save i-amolo/5a62443b5db1efe53afbbe96fc71306b 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