allow to specify a remote host port to use for the sftp log rotator.

This commit is contained in:
Johanna Amann 2014-11-20 15:23:14 -08:00
parent 20a8ec53ca
commit f607d6aa30

View file

@ -37,6 +37,8 @@ export {
user: string; user: string;
## The remote host to which to transfer logs. ## The remote host to which to transfer logs.
host: string; host: string;
## The port to connect to. Defaults to 22
host_port: count &default=22;
## The path/directory on the remote host to send logs. ## The path/directory on the remote host to send logs.
path: string; path: string;
}; };
@ -63,8 +65,8 @@ function sftp_postprocessor(info: Log::RotationInfo): bool
{ {
local dst = fmt("%s/%s.%s.log", d$path, info$path, local dst = fmt("%s/%s.%s.log", d$path, info$path,
strftime(Log::sftp_rotation_date_format, info$open)); strftime(Log::sftp_rotation_date_format, info$open));
command += fmt("echo put %s %s | sftp -b - %s@%s;", info$fname, dst, command += fmt("echo put %s %s | sftp -P %d -b - %s@%s;", info$fname, dst,
d$user, d$host); d$host_port, d$user, d$host);
} }
command += fmt("/bin/rm %s", info$fname); command += fmt("/bin/rm %s", info$fname);