[LogRotatorSink] Rename files after rotation

So, files are created first with a “.tmp” extension, and I’d like to change that extension to “.log” (and ideally also moving the files to a different location) every time the sink rotates.

I’ve been playing around with the sinkFactory (like the compression example), but I fail to see how to build a flow to do that, or even if that’s possible (I’m still wrapping my head around Akka Streams).

1 Like

I figured it out myself:

I can modify the flow passed to the withSinkFactory using mapMaterializedValue to access the materialized value of the sink (fileIO.toPath), and then rename the files when the Future[IOResult] completes.