Send logs to logstash and elasticsearch but miss some logs

Here is my situation.I write a java app which read my logs from file.Then the java app send logs to logstash.The logstash filter the logs and then send them to elasticsearch.However I found that some logs are missed and the more logs the more missed.Therefore I slow down the java app with Thread.sleep() each 500 logs.I guess that is because the reading speed of the java app is too fast.How could I handle this situation?

It seems like that is the problem of udp packet dropped by kernel.