logging SFTP details in a log file...


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers logging SFTP details in a log file...
# 1  
Old 08-17-2006
logging SFTP details in a log file...

hi all.....
i want to know how to log the details when logging into a server using SFTP......in FTP i used something like (ftp -uv<xxx.srp>>log_file.log) where the details will be logged to log_file...is there any options for doing the same in SFTP....i wanted to display the details abt all responses from the remote server, as well as report on data transfer statistics...
# 2  
Old 08-18-2006
Prepare an sftp file to get the files like the one below

echo binary > ftpfiles.out
echo lcd LOCAL_DIR >> ftpfiles.out
echo cd RDIR >> ftpfiles.out
echo mget FIL1 FIL2 FIL3 >> ftpfiles.out
echo quit >> ftpfiles.out

#### Establish connection with remote server and get files

export LOG_DEST=/where/you/want/your.log

echo " ============================================================================" | tee -a$ LOG_DEST
echo " Starting file transfer from remote host $SFTPHOST at `date +"%H:%M"` " | tee -a $LOG_DEST
sftp -B ftpfiles.out $SFTPUSER@$SFTPHOST | tee -a $LOG_DEST
echo | tee -a $LOG_DEST
echo | tee -a $LOG_DEST
echo " File transfer completed at `date +"%H:%M"` " | tee -a $LOG_DEST
echo " ============================================================================" | tee -a $LOG_DEST


Hope this helps.
# 3  
Old 08-19-2006
Hi tansha....thanks for ur info....i want to know how to log the details when i loggin into a sftp server itself....may i know a elaborate discription on the answer u given above....
# 4  
Old 08-19-2006
Hi,

Actually when u will run the script as above, it will log the messages (connection) and also file transfer info into the log.

Just give it a ty u will have a better idea when u will see the actual output directed into the log file.

regards
# 5  
Old 08-19-2006
yeah will try...thanks a lot..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Fetching address and user details from log file

Hi All, I have a requirement to get the address values from a large log file along with the user details. line1,line2,city,stateCode,postalCode,countryCode. The below code as advised in the earlier post is giving the user data zgrep -B1 "Failed to calculate Tax" log.2018-05-23.gz | grep... (8 Replies)
Discussion started by: nextStep
8 Replies

2. Shell Programming and Scripting

How to log file processing details to database table usnig UNIX shell script?

we are getting files on daily basis.we need to process these files. i need a unix shell script where we can count 1-The no of files processed 2-No of data/record processed for each files. The script should log these details into a database table. If there is any error while file... (3 Replies)
Discussion started by: Atul kumar
3 Replies

3. Windows & DOS: Issues & Discussions

Xterm logging on Cygwin/X - binary data in log file.

I have Cygwin/X installed on Windows 7. In an xterm, I turned on logging via Main Options > Log to File. When I open my log file with Vim I get a warning that it might be binary. Looking through the file I see what I think are VT datastream escape characters. It makes it hard to use the... (1 Reply)
Discussion started by: gctaylor
1 Replies

4. Solaris

Sudo logging need year details also

Hi All I have a requirement in which during sudo logging, I must get the year details also in sudo log file. As below output is not mentioning the year due to this I will not able to idenfiy that this log belong to 2012 or 2011 or 2010 Dec 12 11:30:21 XYZ sudo: user1 : TTY=pts/5 ;... (4 Replies)
Discussion started by: sb200
4 Replies

5. Shell Programming and Scripting

Event logging to file and display to console | tee command is not able to log all info.

My intention is to log the output to a file as well as it should be displayed on the console > I have used tee ( tee -a ${filename} ) command for this purpose. This is working as expected for first few outputs, after some event loggin nothing is gettting logged in to the file but It is displaying... (3 Replies)
Discussion started by: sanoop
3 Replies

6. Shell Programming and Scripting

Logging ALL standard out of a bash script to a log file, but still show on screen

Is it possible to store all standard-out of a bash script and the binaries it calls in a log file AND still display the stdout on screen? I know this is possible to store ALL stdout/stderr of a script to a single log file like: exec 1>&${logFile} exec 2>&1 But running a script with the... (3 Replies)
Discussion started by: ckmehta
3 Replies

7. AIX

sftp log file

Hello. we're using sftp to send 2 files to a remote system. It seems that for every 'good' SFTP entry in the log - it is preceded immediately by an error - generally separated by a single second...but sometimes with the exact same timestamp. any idea why that is? sftp.log: 02/17/09 at... (1 Reply)
Discussion started by: udelalv
1 Replies

8. UNIX for Dummies Questions & Answers

Script for parsing details in a log file to a seperate file

Hi Experts, Im a new bee for scripting, I would ned to do the following via linux shell scripting, I have an application which throws a log file, on each action of a particular work with the application, as sson as the action is done, the log file would vanish or stops updating there, the... (2 Replies)
Discussion started by: pingnagan
2 Replies

9. UNIX for Dummies Questions & Answers

sftp log file

Hi, I am running this command to sftp a file: sftp -o identityfile=/blah/blah/.ssh/key blah@mass019 > log.log I want to write the output to a log file, but for some reason when the sftp errors out the log file is empty. It seems that it writes to the log only if the connection is... (2 Replies)
Discussion started by: queenie680
2 Replies

10. Shell Programming and Scripting

Read relevent details from Log File

Hi All, We have requirement to read XML details from large Log File and save in new file name. I have enclosed the sample xml which has start tag <OUTBOUND_MESSAGE xmlns="http://www.abc.com"> and the end tag as </OUTBOUND_MESSAGE> The log file contains many lines with other details which... (6 Replies)
Discussion started by: thinakarmani
6 Replies
Login or Register to Ask a Question