I'm trying to run my docker-compose containers via a systemd service, and have fail2ban read their logs. However, docker-compose adds a prefix like:
container_name_1 | Actual log message
So what I'm trying to do is something like docker-compose up --no-color 2>&1 | sed 's/^[^ ]* *| //' to strip that prefix so that fail2ban can match on the log lines correctly. But when I do that, I only see Started mydockercontainers.service in the journalctl logs. Removing the pipe to sed fixes everything.
How can I remove this prefix and keep the log messages in the journal?