0

I use rsync with --log-file option in crontab.

How can I exclude error messages from the rsync_out.log file?

$ rsync -ahW ./test.txt /media/nas/mycloudex2ultra/ --log-file=rsync_out.log
rsync: [sender] link_stat "/media/usb/downloads/wdmycloud/test.txt" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1333) [sender=3.2.3]
$ cat rsync_out.log
2022/08/10 22:56:23 [140530] building file list
2022/08/10 22:56:23 [140530] rsync: [sender] link_stat "/media/usb/downloads/wdmycloud/test.txt" failed: No such file or directory (2)
2022/08/10 22:56:23 [140530] sent 24 bytes  received 17 bytes  total size 0
2022/08/10 22:56:23 [140530] rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1333) [sender=3.2.3]

I just want to keep relevant information:

$ rsync -ahW ./test.txt /media/nas/mycloudex2ultra/ --log-file=rsync_out.log
$ cat rsync_out.log
2022/08/10 23:10:51 [144146] building file list
2022/08/10 23:10:51 [144146] >f+++++++++ test.txt
2022/08/10 23:10:51 [144146] sent 118 bytes  received 40 bytes  total size 6
emmto
  • 1
  • Have you tried `--ignore-errors`? – cutrightjm Aug 11 '22 at 01:49
  • @cutrightjm, yes but doesn't do it: `$ rsync -ahW --ignore-errors ./test /media/nas/mycloudex2ultra/ --log-file=./rsyn c_out-test.log rsync: [sender] link_stat "/media/usb/downloads/test" failed: No such file or directory (2) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1333) [sender=3.2.3]` – emmto Aug 13 '22 at 08:44
  • `$ cat rsync_out-test.log` `2022/08/13 10:43:27 [301711] building file list 2022/08/13 10:43:27 [301711] rsync: [sender] link_stat "/media/usb/downloads/test" failed: No such file or directory (2) 2022/08/13 10:43:27 [301711] sent 24 bytes received 17 bytes total size 0 2022/08/13 10:43:27 [301711] rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1333) [sender=3.2.3]` – emmto Aug 13 '22 at 08:49

0 Answers0