Technology Blog Posts by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
anikesh_jyotishi2
Participant
8,028

Overview

In this blog, I have outlined the steps to enable SAP BTP audit, retrieve logs, and provide details on all audit log subscriptions.                                      

DISCLAIMER

The content of this blog post is provided “AS IS”. This information could contain technical inaccuracies, typographical errors, and out-of-date information. This document may be updated or changed without notice at any time. Use of the information is therefore at your own risk. In no event shall SAP be liable for special, indirect, incidental, or consequential damages resulting from or related to the use of this document.

Purpose           

In this section, you can find information about audit log functionalities in the Cloud Foundry environment.

SAP Audit Log is a core, security, and compliance-based service within SAP BTP, designed for audit purposes. The Audit Log Service for SAP BTP Applications and Services offers the following features:

Default Features:

Compliance audit data from SAP BTP services and applications is written using the oAuth2 service plan. By default, this data is retained for 90 days at no additional cost, and retrieval of audit data within this period is managed through the Auditlog Management Service.

Advanced Features:

Write audit data from your own BTP applications., Configure the retention period.

These advanced features help you comply with SAP Product Standards and industry regulations. To enable them, you need to activate the premium edition service plan, which incurs additional costs based on usage, Audit logs are a special type of log that provide security-relevant chronological records, serving as documentary evidence for events or activities. The table below illustrates the differences between audit logs, activity logs, and application logs. Note that SAP Audit Log only stores audit logs written by SAP BTP services when actions are taken on your account data.

SAP BTP Audit API service Subscriptions.

3 plans or subscription SAP provided for BTP Audit logs

Premium Subscription :-  Reach out to SAP with retantion period

Default Plan :- Fetch Audit log for subaccount

Central Plan  :- Fetch Audit logs for Global account

 

SAP BTP Audit logs Enable / View

   Prerequisite

You should have the SAP BTP CLI installed on your machine. Additionally, the Postman tool should be installed to retrieve logs.

   Steps: –

  • Create Service Instance for Service
  • Create a key for the service instance
  • List the key of the service instance
  • Audit Log Retrieval:-
  • Generate OAUTH2 post access key
  • Retrieval log using Get via access key

Create Service Instance for Service:-  

             Create service instance via CLI command line :-

cf create-service auditlog-management default serviceInstance

anikesh_jyotishi2_0-1720797191441.png

I have named the instance "serviceInstance," but you can choose a name that suits your preference.

Create a key for the service instance:-

Create Key for service instance via CLI command line :-

cf create-service-key serviceInstance key

anikesh_jyotishi2_1-1720797267617.png

I have named the Key "key," but you can choose a name that suits your preference.

List the key of the service instance:-

cf service-key serviceInstance key

anikesh_jyotishi2_0-1720800464754.png

 

List all keys, users id, password and URLs.

All below info you will get from above command output

Client ID:-

Client secret:-

URL 1:- https://abc.eu10.hana.ondemand.com

URL2 :- https://auditlog-management.cfapps.eu10.hana.ondemand.com

 

  • Audit Log Retrieval:-
  • Generate OAUTH2 post access key

anikesh_jyotishi2_4-1720795973221.png

 

Open postman tool and select post use URL1 with /oauth/token?grant_type=client_credentials extension for get new access token for retrieve audit logs.

Generate access token and use for GET audit logs from BTP sub account

 

  • Retrieval log using Get via access key

 

Open postman tool and select post use URL2 with /auditlog/v2/auditlogrecords extension for retrieve audit logs.

 

anikesh_jyotishi2_0-1720796729582.png

 

 

 

 

All output will be formatted into JSON. You can copy this output and view it in Excel or use visualization tools for better structure.

You can use this JSON format to import into Excel or a visualization tool. Here’s how to do it:

  1. Copy the JSON data above.
  2. Open Excel.
  3. Go to the Data tab.
  4. Click on Get Data > From Other Sources > From Web.
  5. Paste the JSON data into the URL box and proceed.

For a more complex or customized data set, provide the details, and I'll format it accordingly.

 

Reference SAP Notes :-

 

https://help.sap.com/docs/btp/sap-business-technology-platform/audit-log-retrieval-api-usage-for-sub...

2637286 - How to collect Audit Logs for SAP BTP

Advantages:-

Useful for audit, review activities and fix development issues

anikesh_jyotishi2_6-1720795973245.png

 

I hope this document will help you with the BTP Audit log Enable and retrieve logs

 

Cheers!

Anikesh Jyotishi

2 Comments
AnilKumar0610
Discoverer
0 Kudos

Great share! Useful Blog

tripti197
Explorer
0 Kudos

would have been great if you have given the postman steps more clearly then just screenshots. 

Labels in this area