-
-
Save hidepin/873d84d86dcc9c2c0f9a to your computer and use it in GitHub Desktop.
{ | |
"template" : "apache_log*", | |
"mappings" : { | |
"www3" : { | |
"properties" : { | |
"remote-host" : { | |
"type" : "string" | |
}, | |
"request-header-Referer" : { | |
"type" : "string" | |
}, | |
"request-header-User-Agent" : { | |
"type" : "multi_field", | |
"fields" : { | |
"request-header-User-Agent" : { "type" : "string", "index": "analyzed" }, | |
"full" : { "type" : "string", "index": "not_analyzed" } | |
} | |
}, | |
"request-line" : { | |
"type" : "string" | |
}, | |
"request-process-time-us" : { | |
"type" : "long" | |
}, | |
"request-time" : { | |
"type" : "date", | |
"format" : "dateOptionalTime" | |
}, | |
"response-status" : { | |
"type" : "long" | |
}, | |
"response-total-bytes" : { | |
"type" : "long" | |
} | |
} | |
} | |
} | |
} | |
} |
{
"template" : "apache_log_",
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
"method" : {
"type" : "pattern",
"pattern" : " ."
},
"url" : {
"type" : "pattern",
"pattern" : "^[A-Z]+|?."
},
"api" : {
"type" : "pattern",
"pattern" : "?._"
}
}
}
}
},
"mappings" : {
"www1" : {
"properties" : {
"remote-host" : {
"type" : "string",
"index" : "not_analyzed"
},
"request-header-Referer" : {
"type" : "string",
"index" : "not_analyzed"
},
"request-header-User-Agent" : {
"type" : "multi_field",
"fields" : {
"request-header-User-Agent" : {
"type" : "string",
"index" : "analyzed"
},
"full" : {
"type" : "string",
"index" : "not_analyzed"
}
}
},
"request-line" : {
"type" : "multi_field",
"fields" : {
"request-line" : {
"type" : "string",
"index" : "analyzed"
},
"method" : {
"type" : "string",
"index" : "analyzed",
"analyzer" : "method"
},
"url" : {
"type" : "string",
"index" : "analyzed",
"analyzer" : "url"
},
"api" : {
"type" : "string",
"index" : "analyzed",
"analyzer" : "api"
},
"full" : {
"type" : "string",
"index" : "not_analyzed"
}
}
},
"request-process-time-us" : {
"type" : "long"
},
"request-time" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"response-status" : {
"type" : "long"
},
"response-total-bytes" : {
"type" : "long"
}
}
},
curl -XPUT http://192.168.0.56:9200/apache_log -d @multi.json
embulk bundle update && bundle exec embulk preview config.yml
cd - && ./gradlew gem && cd - && embulk bundle update && bundle exec embulk preview config.yml
gem 'embulk-parser-apache-custom-log', path: '/home/hidepin/embulk/embulk-parser-apache-custom-log'
gem 'embulk-output-elasticsearch'