I am using filebeat to fetch logs, logstash to filter, and pushing them to elasticsearch.
I have created an index on elasticsearch import-export-logger.
This id mapping of import-export-logger.
{
"import-export-logger" : {
"aliases" : { },
"mappings" : {
"_doc" : {
"properties" : {
"@timestamp" : {
"type" : "date"
},
"currentMilestone" : {
"type" : "integer"
},
"date" : {
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss.SSS"
},
"description" : {
"type" : "text"
},
"exportFrequency" : {
"type" : "keyword"
},
"exportQueueType" : {
"type" : "keyword"
},
"facilityCode" : {
"type" : "keyword"
},
"failedImportMilestone" : {
"type" : "integer"
},
"fileURL" : {
"type" : "text"
},
"jobCreatedDate" : {
"type" : "date",
"format" : "yyyy-MM-dd HH:mm:ss.SSS"
},
"jobID" : {
"type" : "keyword"
},
"jobName" : {
"type" : "keyword"
},
"jobType" : {
"type" : "keyword"
},
"message" : {
"type" : "text"
},
"requestID" : {
"type" : "keyword"
},
"status" : {
"type" : "keyword"
},
"successfulImportMilestone" : {
"type" : "integer"
},
"tenantCode" : {
"type" : "keyword"
},
"totalMilestone" : {
"type" : "integer"
},
"userName" : {
"type" : "keyword"
}
}
}
},
"settings" : {
"index" : {
"creation_date" : "1657625688183",
"number_of_shards" : "5",
"number_of_replicas" : "1",
"uuid" : "TWK_Ha4ZR9SUSDCwXyLeGA",
"version" : {
"created" : "6050499"
},
"provided_name" : "import-export-logger"
}
}
}
}
This is the output section of logstash config file
elasticsearch {
hosts => [ "localhost:9200" ]
index => "import-export-logger-%{index-name}"
http_compression => true
}
Here I want elasticsearch to create a new index but with the mapping of import-export-logger index rather tan creating new mapping on its own.
Mapping for output index import-export-logger-2020-11-06 is
{
"import-export-logger-2020-11-06" : {
"mappings" : {
"doc" : {
"properties" : {
"@timestamp" : {
"type" : "date"
},
"beat" : {
"properties" : {
"hostname" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"name" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"version" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
},
"created_timestamp" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"currentMilestone" : {
"type" : "long"
},
"current_timestamp" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"description" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"exportFrequency" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"exportQueueType" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"facilityCode" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"failedImportMilestone" : {
"type" : "long"
},
"fields" : {
"properties" : {
"target_index" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
},
"fileURL" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"index-name" : {
"type" : "date"
},
"jobID" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"jobName" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"jobType" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"message" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"requestID" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"source" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"status" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"successfulImportMilestone" : {
"type" : "long"
},
"tags" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"tenantCode" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"totalMilestone" : {
"type" : "long"
},
"userName" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
}
}
}
}
}
}
Can anyone help me with how should I configure my files to get the desired mapping