I'm trying to create a custom beat that accepts input log input via stdin. For example you might feed a single completed log file into this beat like this:
cat myapp.log | mybeat
The problem that I'm having is that my beat exits before the publisher.Client has a chance to flush and send log events to the destination (Elasticsearch, for example). If I put a time.Sleep(5 * time.Second) after my custom beat completes, but before main exits, my events make it to Elasticsearch. Is there a cleaner way for me to ensure that the publisher.Client has flushed before exiting the application?