IBM Support

Collecting log files by timestamp

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.

[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":null,"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

NZ226282

Document Information

Modified date:
17 October 2019

UID

swg21567946