0

I need to transfer a couple of log-files each hour to a logstorage which all users can reach, and I use rsync for do that, but the problem comes when the log-file is rotated and automatically zipped, rsync detects there is a new file and it transfered it too, that means on the destination server I have:

example.log.2014-01-17--00

and

example.log.2014-01-17--00.gz

which is the same logfile but zipped with gzip -9.

this is my rsync line, it is included into a script:

rsync -rvzt --include "*/" --include "$pattern" --exclude "*" $directory user@123.456.789.000:/home/user/directory/$subdir/$basefilename

it is executed each hour by a crontab, and it transfer all files matching a $pattern and $directory included in a file which contains paths and patterns I want to transfer.

So my question is if there is an rsync option that I have not seen, or if there is some posibility to do that and how.

Thanks in advance.

1
  • @Andryoid - Reading the --include/--exclude sequence: get all subfolders */, only with pattern $pattern, but then exclude everything *? Did I interpret the intent, and if so, that doesn't sound right. Wouldn't it be, get all subfolders */, only with pattern $pattern, but then strip off files with .gz, which would be: --exclude "*.gz". Without def's for $subdir, $basefilename, and example path - pretty much a complete example, that's what I can think of off the top of my head. – Billy McCloskey Jan 17 '14 at 14:33
0

Have you considered using rsyslog forwarding [1]?

Also, from [2], it looks like adding --exclude '*.gz' should fix your issue. Why do you --exclude '*'? My reading of that would be that every file is excluded from the sync.

[1] http://www.rsyslog.com/storing-and-forwarding-remote-messages/

[2] http://www.thegeekstuff.com/2011/01/rsync-exclude-files-and-folders/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.