ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

SFTP Log results

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SFTP Log results

    Hi all,
    I want to capture the log after some sftp transfers from AS400 to another server, but I want to have informations such "transfer succeded" or "transfer failed", something like this.. I want to record this in a historization file to have an evidence.

    For FTP I know that we have some return codes in the output file for transfer succeded or not but here, in ssh/sftp, I don't know exactly how can I determine with a nice solution if it is ok or nok the transfer, I redirected the information from the SSH session with QSH CMD('sftp -vvv -b /home/SSH_USER/SCRIPT_SSH.txt USER_REMOTE@IP_REMOTE > /home/SSH_USER/logout.txt 2>&1')

    and I have a lot of information in the logout.txt file in the IFS but.. for a easy and complete solution how can I verify? I want to make also the error handling part for these sftp transfers, I want to copy all the records from logout.txt into a DB2 file and after read this file and check if I have "Transferred" word or not but I don't know if it is the best solution to handle this.

    Thanks in advance guys if you have another ideas

  • #2
    I have like this after a succesful transfer, I found the files transferred to the remote system but the log redirected in the /home/ssh_user/logout.txt ends like this:
    Transferred: sent 4264, received 3864 bytes, in 0.7 seconds
    Bytes per second: sent 6004.0, received 5440.8
    debug1: Exit status -1

    what it means exit status -1 since the files have been sent..?
    in the script for ssh transfer I have these commands:
    cd directory1_on_the_remote_system
    put /home/SSH_USER/my_file.txt
    quit

    Comment


    • #3
      Originally posted by voicucosmin90 View Post
      Hi all,
      I want to capture the log after some sftp transfers from AS400 to another server, but I want to have informations such "transfer succeded" or "transfer failed", something like this.. I want to record this in a historization file to have an evidence.

      For FTP I know that we have some return codes in the output file for transfer succeded or not but here, in ssh/sftp, I don't know exactly how can I determine with a nice solution if it is ok or nok the transfer, I redirected the information from the SSH session with QSH CMD('sftp -vvv -b /home/SSH_USER/SCRIPT_SSH.txt USER_REMOTE@IP_REMOTE > /home/SSH_USER/logout.txt 2>&1')

      and I have a lot of information in the logout.txt file in the IFS but.. for a easy and complete solution how can I verify? I want to make also the error handling part for these sftp transfers, I want to copy all the records from logout.txt into a DB2 file and after read this file and check if I have "Transferred" word or not but I don't know if it is the best solution to handle this.

      Thanks in advance guys if you have another ideas

      guys.. can you help me with some help with the check of the output file after the sftp transfer? how can I automate the checking to know if the transfer was succesful or not? Can I verify the messages, to copy into DB2 file and after verify if I have a message like "%Permission denied%" or something else?

      But I saw.. If I am able to connect through ssh/sftp to the remote machine but the file to transfer specified in the script file doesn't exist in the IFS for example, I also have the message Trasferred: sent xxx, received xxx bytes, in xxx seconds, .. although the file wasn't transfered, because the file wasn't there, probably the message "%Transferred: sent..%" refers to the data transfererd concerning the matching of the key...
      and I want to be able to verify after this messages from output file if the transfer was succesful, how can I determine? exist a key word only when the transfer was succesful?

      Comment

      Working...
      X