You are currently viewing How to archive logs in OCI for longer periods of time

How to archive logs in OCI for longer periods of time

This post is part of the OCI Logging – Complete Hands-on Series. Make sure to check out the other posts as well.

Intro

OCI Logging provides a retention period between 1 and 6 months. In some cases, we need to store this data for more than 6 months.

We have two options in OCI:

  1. Send the logs to OCI Logging Analytics where the logs can be stored for an indefinite period of time (of course we can create Lifecycle policies to archive and delete the data based on our needs)
  2. Send the logs to OCI Object Storage for archival purposes

In this article, we’ll look at the second option, but you can check out Analyze logs in OCI with Logging Analytics to make your life easier (soon) for more info on the first option.

Send logs to Object Storage

Once you have configured any types of logs in OCI, you can select a retention period of up to 6 months. The retention period can be selected at the creation of the logs or can be edited later on for Custom Logs.

In order to send the logs to Object Storage, we need to create a Bucket first and then a Service Connector.

Create an Object Storage Bucket

To create a bucket, it’s quite straightforward. You could however choose to create it in Standard or Archive mode. If you choose Standard, you can create Lifecycle policies later on to archive the data after a specified number of days.

If immidiate acces to logs is required, I suggest creating in Standard mode and then create a Lifecycle Policy to send the data to Infrequent Access Tier to save some money. If you don’t need immidiate access to the files, you can chose directly Archive mode.

Create a Service Connector

We’ll use a Service Connector to move the logs from OCI Logging to Object Storage. You can find the Service Connector under Observability & Management –> Logging –> Service Connector.

Give it a name and a description and select Logging as Source and Object Storage as Target

When configuring the Source you can select what Logs you want to send. You can select a whole Log Group or multiple Groups or individual logs. It’s up to you. You can even filter your logs to send only specific entries – but for this case we’ll send everything.

You can also configure a Task – calling a function to do something before sending the logs to Object Storage.

And at the end, we’ll select our Bucket as Target and we’ll be prompted with a message to create a default policy to allow Service Connector to write to Object Storage. Don’t forget to click on create, otherwise this will not work.

Check Service Connector Metrics

Once it was configured, you can check the Service Connector Metrics to gain some insight into its performance.

Image Rights

Ionut Adrian Vladu

I enjoy building python scripts for…everything! I am a Cloud enthusiast and I like to keep up with technology. When I'm not behind a computer, I like taking photos -- Visit My 500px profile -- or sit back and enjoy Formula 1 race weekends. Currently, working as a Tech Cloud Specialist @ Oracle
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments