Collecting json with filebeat, missing end of line
Hello, We are collecting all Clockwork's json files thanks to filebeat and we push them to ElasticSearch. It allows us to use Graylog for consulting all what we have collected with Clockwork.
As Clockwork is writting a new file for every request instead of writting a new line in the same and unique log file (like monolog), filebeat wasn't able to understand that the file content is ready to be collected and pushed to ElasticSearch.
Filebeat requires an "end of line" to detect that the line is written and won't change. Then only will filebeat collect the line and keeps watching the new line. (It works well with multineline logs like with monolog).
The system works fine only when we override the method store from \Clockwork\Storage\FileStorage.
$this->compress
? file_put_contents("{$path}.gz", gzcompress($data))
: file_put_contents($path, $data);
becomes
$this->compress
? file_put_contents("{$path}.gz", gzcompress($data))
: file_put_contents($path, $data . "\n");
Could it be possible to permanently add it to the original class ?
Julien
Hey, sure, I don't see why not. Would you like to make a PR?
Included in Clockwork 5.2.