Skip to content

WIP: Add `--follow` option for files

Before raising this MR, consider whether the following are required, and complete if so:

  • Unit tests
  • Metrics
  • Documentation update(s)

Requires README update before merging

Description

This adds an optional --follow option to be used with --file. That option will keep attempting to read changes from the end of a file until signaled to exit.

Changes proposed in this merge request:

  • Add signal handler for SIGINT and SIGTERM
  • streamFromFd(): add follow argument. If set, keep reading until signal handler sets signalReceived to true.

Validation

Given an already-existing logstream resource name:

> echo -n "Hello," > /tmp/file
> ./outputstreamer --resource-name=RESOURCE --logstream-server=http://localhost:50051 --file=/tmp/file --follow
> echo -n " world!" >> /tmp/file
> killall outputstreamer

Should result in "Hello, world!" being written to the stream and committed after outputstreamer receives a signal to terminate.

Merge request reports