mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
allow to specify a remote host port to use for the sftp log rotator.
This commit is contained in:
parent
20a8ec53ca
commit
f607d6aa30
1 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue