Write a script that takes all .log files in the dir “/var/log/app” and if
they are older than X days (the number of days will be received as an
argument) tar.gz them with the current date suffix and move them to
“/var/log/app/archive”
>Solution :
Break it in tasks.
Finding all .logs in a folder not older than a certain time can be done
via find. Check the options maxdepth to stay on one level and mtime for the age.
tar cgf someLog.log.tar.gz --remove-files logfile.log can add it to an archive and delete the file.
mv to move the files. Alternatively you can try to add -C to the tar command, if you feel fancy.
With those commands you should be able to write your script.