Oracle OCI – View Console Logs

TLDR – How to view instance console logs using the Oracle OCI Command Line tool

Console History

I was working a case last week where a customer asked, “how can I determine if an OCI instance was restarted due to hypervisor issue” Which is a great question. Sadly I was not able to come up with a great answer for the customer. It’s due to a lack of trying. Internally we can see the history of all operations that run against an instance, like, creation, volume attaches, soft restarts, ETC. Externally there is no similar log for an instance. Searching for a solution, I went through all of the OCI CLI (Command Line Interface) and found some other interesting commands I did not know existed.

The stand out commands was the console-history command. One of the troubleshooting tools we have access to internally is a full log of the console. For Linux, is this great you can see everything that would have been displayed on the console screen. For windows, it is not so helpful. To download the console history, you need to know your instance OCID and run the following three commands.

Capturing and viewing the console history

To capture the console history run the following commands

oci compute console-history capture --instance-id

Screenshot 2020-06-07 at 15.32.36.png

From the above command capture the OCID in the ID field and use it in the below command to download a text file containing the console logs

oci compute console-history get-content --instance-console-history-id --file bob.txt

You can run cat bob.txt to view  the contents of the log file in the command line

Screenshot 2020-06-07 at 09.42.21.png

Leave a Reply

%d bloggers like this: