Question & Answer
Question
Is there a way to bundle log files by time since now?
Answer
Yes, you can use the find command to create a tar file of all the plans and/or logs for a given time period.
In the following example, the command searches the Netezza log directory for regular files (-type f) that were modified 120 minutes prior to now (-mmin -120):
find /nz/kit/log/ -type f -mmin -120 | xargs tar -rf /tmp/logs.tar
gzip /tmp/logs.tar
Using xargs, it then passes the resulting list to the tar command. It then uses gzip to compress the resulting file into the smallest file size. The result is a file (/tmp/logs.tar.gz) that is ready to be transferred off the system.
You can also use the find command to collect files in other log directories such as the /var/log directory and vary the time to suit your troubleshooting needs.
Historical Number
NZ226282
Was this topic helpful?
Document Information
Modified date:
17 October 2019
UID
swg21567946