1

I have an lftp script file that I use for mirroring some directories over sftp, so I run the command using something like lftp -f mirror_dirs.lftp. I would now like to log the transfers to a specific log file so that later, perhaps in a forensic context, I can determine what files were transferred and when. I don't want to put options in a file like ~/.lftp/rc since I don't want to pollute my log file with information from other, ad-hoc, lftp commands I might issue. I have read the lftp manual and remain quite confused.

It seems like what I want to do is log transfers. The manual mentions the following:

   log:enabled (boolean)
          when  true,  the  log messages are output. The closure for this
          and other 'log:' variables is either `debug' for debug messages
          or 'xfer' for transfer logging.

   log:file (string)
          the target output file for logging. When empty, stderr is used.

This "closure" business is particularly confusing to me, as is its syntax. As far as I can tell the "closure" is a way to provide a more specific context for a command. Here was my initial attempt:

set log/xfer:enabled true
set log/xfer:file "/Logs/lftp_transfer.log"
set log/xfer:show-time true
set mirror:parallel-directories true

open "sftp://user99:[email protected]"
mirror --verbose -c / tests/

which resulted in the error message /Logs/lftp_transfer.log: invalid boolean value, so obviously I have not understood the syntax.

How can I correctly specify transfer logging in an lftp script file.

2
  • Please try set xfer:log 1 set xfer:log-file "/Logs/lftp_transfer.log"
    – BANJOSA
    Commented Mar 4, 2020 at 14:50
  • @BANJOSA: Ok, that seemed to work perfectly, thanks. I wonder what all that business about "closures" was in the manual. Also, I didn't see those settings mentioned anywhere in the man page. Commented Mar 4, 2020 at 15:22

1 Answer 1

2

you should change your configuration to:

set xfer:log 1 
set xfer:log-file "/Logs/lftp_transfer.log"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .