Answer the question
In order to leave comments, you need to log in
CentOS 6.5: need to write internal-sftp and sshd logs to different files
Clean and completely updated Centos 6.5, OpenSSH version 5.3p1-94.el6, classic settings:
/etc/rsyslog.d/sftp.conf
$AddUnixListenSocket /var/www/vhosts/user1/dev/log
:programname, isequal, "internal-sftp" -/var/log/sftp.log
:programname, isequal, "internal-sftp" ~
Subsystem sftp internal-sftp -l VERBOSE
Match Group sftp
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp -l VERBOSE
Jun 8 12:08:01 srv sshd[10371]: Accepted password for user1 from IP port 38817 ssh2
Jun 8 12:08:01 srv sshd[10371]: pam_unix(sshd:session): session opened for user user1 by (uid=0)
Jun 8 12:08:01 srv sshd[10373]: subsystem request for sftp
...
Jun 8 12:08:01 srv internal-sftp[10374]: session opened for local user user1 from [IP]
Jun 8 12:08:01 srv internal-sftp[10374]: received client version 3
Jun 8 12:08:01 srv internal-sftp[10374]: opendir "/"
Jun 8 12:08:01 srv internal-sftp[10374]: closedir "/"
...
Jun 8 12:11:01 srv sshd[10825]: Accepted password for user1 from IP port 38821 ssh2
Jun 8 12:11:01 srv sshd[10825]: pam_unix(sshd:session): session opened for user user1 by (uid=0)
Jun 8 12:11:01 srv sshd[10827]: subsystem request for sftp
Jun 8 12:11:01 srv sshd[10828]: session opened for local user user1 from [IP]
Jun 8 12:11:01 srv sshd[10828]: received client version 3
Jun 8 12:11:01 srv sshd[10828]: opendir "/"
Jun 8 12:11:01 srv sshd[10828]: closedir "/"
...
if $programname == 'sshd' and ($msg startswith 'open' or $msg startswith 'close' ...) then /var/log/sftp.log
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question