If you have GNU tar, you can use the --transform or --strip-components options to get a flat archive, without the directory tree. Something like:
tar cf foo.tar --transform='s:.*/::' /root/dir1/f1* /root/dir2/f2* /root/dir1/log.txt
GNU tar will warn about the leading / in the file names, but we're removing them anyway.
Alternately, with a couple of cds:
cd /root/dir1; tar cf /some/where/foo.tar f1* log.txt cd /root/dir2; tar uf /some/where/foo.tar f2*
Here, we'll need to specify a path to the tar archive that won't be affected by the cds (so an absolute path, or since both are directories in /root, a path to the parent folder).
findandtartogether something likefind mydir -maxdepth 1 -type f -name "f1" -print0 | xargs -0 tar cvf mydir.tar