Ravi Teja Kothuru
Ravi Teja Kothuru

Reputation: 19

Fetch the Trace log path dynamically using Python or Shell script

I have a use-case where I need to traverse into the path /u01/app/oracle/diag/rdbms/abc_def/abcdef/trace/ and fetch the trace logs.

Basically, the trace logs path is same but the values of the path vary from DB server to DB server.

For Oracle RBMS, let’s say the above said path will have oracle , and rdbms/abc_def/abcdef .

For the other DB, these words might vary.

Now, the main concern is - how can I derive this path dynamically (using Python or shell script whatever is possible) and then read the trace logs instead of hardcoding this path.

Could someone please suggest me on this?

Upvotes: 0

Views: 129

Answers (1)

PhilBug
PhilBug

Reputation: 11

If you know all the values in advance you can use the following bash syntax:

ls /u01/app/oracle/diag/{oracle,postgres,mysql}/abc_def/abcdef/trace

If you don't know the values - you can just use a wildcard like so:

ls /u01/app/oracle/diag/*/abc_def/abcdef/trace

Upvotes: 0

Related Questions