Collect Oracle Fusion Cloud Applications logs

Supported in:

This document explains how to ingest Oracle Fusion Cloud Applications logs to Google Security Operations using Google Cloud Storage V2.

Oracle Fusion Cloud Applications is Oracle's comprehensive suite of cloud-based enterprise resource planning (ERP), human capital management (HCM), supply chain management (SCM), and customer experience (CX) applications. The platform provides extensive audit logging capabilities through REST APIs, capturing user authentication events, transaction changes, administrative actions, and security-related activities across all Fusion modules. A Cloud Run function queries the Oracle Fusion Audit REST API to retrieve this data and writes it to a GCS bucket for ingestion by Google SecOps.

Before you begin

Ensure that you have the following prerequisites:

  • A Google SecOps instance
  • A GCP project with Cloud Storage, Cloud Run, Pub/Sub, and Cloud Scheduler APIs enabled
  • Permissions to create and manage GCS buckets
  • Permissions to manage IAM policies on GCS buckets
  • Permissions to create Cloud Run services, Pub/Sub topics, and Cloud Scheduler jobs
  • Administrator access to Oracle Fusion Cloud Applications
  • Administrator access to the Oracle Cloud Infrastructure (OCI) Identity and Access Management (IAM) identity domain associated with your Fusion Applications instance
  • A Fusion Applications user account with the FND_VIEW_AUDIT_HISTORY_PRIVprivilege or Fusion Apps Administratorrole

Configure Oracle Fusion Cloud Applications OAuth 2.0 API access

To enable Google SecOps to retrieve audit logs, you need to create an OAuth 2.0 confidential application using the Client Credentials grant type and configure the client ID as a user in Fusion Applications.

Create OAuth 2.0 confidential application

  1. Sign in to the Oracle Cloud Infrastructure Consolewith your identity domain administrator credentials.
  2. In the menu bar, click Identity & Security > Domains.
  3. Select your compartment.
  4. Click the identity domain associated with your Fusion Applications instance.
  5. In the menu bar, click Integrated applications > Add application.
  6. On the Add applicationdialog box, select Confidential Applicationand click Launch workflow.
  7. On the Add Confidential Applicationpage, in the Namefield, enter a descriptive name (for example, Chronicle SIEM Integration ).
  8. Click Next.
  9. In the Configure OAuthsection, select the Configure this application as a client nowcheckbox.
  10. In the Authorizationsection, select the Client credentialscheckbox.
  11. Clear all other grant type checkboxes.
  12. Scroll down to the Token issuance policysection.
  13. In the Authorized resourcessection, select Specific.
  14. Select the Add resourcescheckbox.
  15. In the Resourcessubsection, click Add scope.
  16. On the Add scopedialog box, locate and select the Fusion Applicationsresource application.
  17. Select the appropriate scope for your Fusion Applications instance.

  18. Click Add.

  19. Click Next.

  20. On the Web tier policypage, accept the default settings and click Finish.

  21. A confirmation dialog box appears displaying the auto-generated Client IDand Client Secretvalues.

  22. Copy and save both the Client IDand Client Secretimmediately.

  23. Click Close.

  24. On the application details page, click Activate.

  25. On the confirmation dialog, click Activate application.

Record identity domain URL

  1. In the Oracle Cloud Infrastructure Console, while viewing your identity domain, note the Domain URLdisplayed at the top of the page.
  2. The domain URL is in the format https://idcs-<idcs-id>.identity.oraclecloud.com .
  3. Save this URL for later use.

In Client Credentials flows, API calls are invoked in the context of the application itself, not a user. You must create a user account in Fusion Applications with the same username as the OAuth client ID.

  1. Sign in to Oracle Fusion Cloud Applications.
  2. Click the Navigatoricon in the top-left corner.
  3. Under Tools, select Security Console.
  4. Click Users.
  5. Click Add User Account.
  6. In the User Informationsection, in the User Namefield, enter the Client IDvalue from the OAuth application.

  7. Complete the remaining required fields:

    • First Name: Enter Chronicle or a descriptive name
    • Last Name: Enter Integration or a descriptive name
    • Email: Enter a valid email address (for example, chronicle-integration@yourcompany.com )
  8. Click Add Role.

  9. Search for and add the following role:

    • Fusion Apps Administrator
  10. Click Save and Close.

Record Fusion Applications base URL

  1. While signed in to Oracle Fusion Cloud Applications, note the URL in your browser's address bar.
  2. The base URL is in the format https://<instance>.<service>.<datacenter>.oraclecloud.com .
  3. Extract the hostname portion only (for example, mycompany.fa.us2.oraclecloud.com ).
  4. Save this hostname for later use.

Verify permissions

To verify the OAuth client has the required permissions:

  1. Sign in to Oracle Fusion Cloud Applications.
  2. Click the Navigatoricon > Tools > Security Console.
  3. Click Usersand search for the user account matching the Client ID.
  4. Verify the user has the Fusion Apps Administratorrole or the FND_VIEW_AUDIT_HISTORY_PRIVprivilege assigned.
  5. If you cannot locate the user or the privilege is missing, contact your Fusion Applications administrator to grant the required role.

Test API access

  • Test your credentials before proceeding with the integration:

      # Replace with your actual values 
     IDENTITY_DOMAIN_URL 
     = 
     "https://idcs-xxxxxxxxxxxx.identity.oraclecloud.com" 
     CLIENT_ID 
     = 
     "your-client-id" 
     CLIENT_SECRET 
     = 
     "your-client-secret" 
     FUSION_HOST 
     = 
     "mycompany.fa.us2.oraclecloud.com" 
     OAUTH_SCOPE 
     = 
     "urn:opc:resource:fusion:podname:boss/" 
     # Step 1: Obtain OAuth access token 
     TOKEN 
     = 
     $( 
    curl  
    -s  
    -u  
     " 
     ${ 
     CLIENT_ID 
     } 
     : 
     ${ 
     CLIENT_SECRET 
     } 
     " 
      
     \ 
      
    -H  
     "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" 
      
     \ 
      
    -X  
    POST  
     " 
     ${ 
     IDENTITY_DOMAIN_URL 
     } 
     /oauth2/v1/token" 
      
     \ 
      
    -d  
     "grant_type=client_credentials&scope= 
     ${ 
     OAUTH_SCOPE 
     } 
     " 
      
     \ 
      
     | 
      
    python3  
    -c  
     "import sys,json; print(json.load(sys.stdin)['access_token'])" 
     ) 
     echo 
      
     "Token obtained: 
     ${ 
     TOKEN 
     : 
     0 
     : 
     20 
     } 
     ..." 
     # Step 2: Test audit history API 
    curl  
    -s  
    -X  
    POST  
     "https:// 
     ${ 
     FUSION_HOST 
     } 
     /fscmRestApi/fndAuditRESTService/audittrail/getaudithistory" 
      
     \ 
      
    -H  
     "Authorization: Bearer 
     ${ 
     TOKEN 
     } 
     " 
      
     \ 
      
    -H  
     "Content-Type: application/json" 
      
     \ 
      
    -d  
     '{"fromDate":"' 
     " 
     $( 
    date  
    -u  
    -v-1d  
     '+%Y-%m-%d' 
     ) 
     " 
     '","toDate":"' 
     " 
     $( 
    date  
    -u  
     '+%Y-%m-%d' 
     ) 
     " 
     '","eventType":"all","pageNumber":"1","pageSize":"5"}' 
      
     \ 
      
     | 
      
    python3  
    -m  
    json.tool 
    

A successful response returns a JSON object with "status": "SUCCESS" and an auditData array containing audit records.

Create Google Cloud Storage bucket

  1. Go to the Google Cloud Console .
  2. Select your project or create a new one.
  3. In the navigation menu, go to Cloud Storage > Buckets.
  4. Click Create bucket.
  5. Provide the following configuration details:

    Setting Value
    Name your bucket Enter a globally unique name (for example, oracle-fusion-audit-logs )
    Location type Choose based on your needs (Region, Dual-region, Multi-region)
    Location Select the location (for example, us-central1 )
    Storage class Standard (recommended for frequently accessed logs)
    Access control Uniform (recommended)
    Protection tools Optional: Enable object versioning or retention policy
  6. Click Create.

The Cloud Run function needs a service account with permissions to write to GCS bucket and be invoked by Pub/Sub.

  1. In the GCP Console, go to IAM & Admin > Service Accounts.
  2. Click Create Service Account.
  3. Provide the following configuration details:
    • Service account name: Enter oracle-fusion-audit-collector-sa
    • Service account description: Enter Service account for Cloud Run function to collect Oracle Fusion Cloud Applications audit logs
  4. Click Create and Continue.
  5. In the Grant this service account access to projectsection, add the following roles:
    1. Click Select a role.
    2. Search for and select Storage Object Admin.
    3. Click + Add another role.
    4. Search for and select Cloud Run Invoker.
    5. Click + Add another role.
    6. Search for and select Cloud Functions Invoker.
  6. Click Continue.
  7. Click Done.

These roles are required for:

  • Storage Object Admin: Write logs to GCS bucket and manage state files
  • Cloud Run Invoker: Allow Pub/Sub to invoke the function
  • Cloud Functions Invoker: Allow function invocation

Grant IAM permissions on GCS bucket

  1. Go to Cloud Storage > Buckets.
  2. Click on your bucket name ( oracle-fusion-audit-logs ).
  3. Go to the Permissionstab.
  4. Click Grant access.
  5. Provide the following configuration details:
    • Add principals: Enter the service account email ( oracle-fusion-audit-collector-sa@PROJECT_ID.iam.gserviceaccount.com )
    • Assign roles: Select Storage Object Admin
  6. Click Save.

Create Pub/Sub topic

  1. In the GCP Console, go to Pub/Sub > Topics.
  2. Click Create topic.
  3. Provide the following configuration details:
    • Topic ID: Enter oracle-fusion-audit-trigger
    • Leave other settings as default
  4. Click Create.

Create Cloud Run function to collect logs

The Cloud Run function will be triggered by Pub/Sub messages from Cloud Scheduler to fetch audit data from the Oracle Fusion Cloud Applications Audit REST API and write it to GCS.

  1. In the GCP Console, go to Cloud Run.
  2. Click Create service.
  3. Select Function(use an inline editor to create a function).
  4. In the Configuresection, provide the following configuration details:

    Setting Value
    Service name oracle-fusion-audit-collector
    Region Select region matching your GCS bucket (for example, us-central1 )
    Runtime Select Python 3.12or later
  5. In the Trigger (optional)section:

    1. Click + Add trigger.
    2. Select Cloud Pub/Sub.
    3. In Select a Cloud Pub/Sub topic, choose oracle-fusion-audit-trigger .
    4. Click Save.
  6. In the Authenticationsection:

    1. Select Require authentication.
    2. Check Identity and Access Management (IAM).
  7. Scroll down and expand Containers, Networking, Security.

  8. Go to the Securitytab:

    • Service account: Select oracle-fusion-audit-collector-sa
  9. Go to the Containerstab:

    1. Click Variables & Secrets.
    2. Click + Add variablefor each environment variable:
    Variable Name Example Value Description
    GCS_BUCKET
    oracle-fusion-audit-logs GCS bucket name
    GCS_PREFIX
    oracle-fusion-audit Prefix for log files
    STATE_KEY
    oracle-fusion-audit/state.json State file path
    FUSION_HOST
    mycompany.fa.us2.oraclecloud.com Fusion Applications hostname
    IDENTITY_DOMAIN_URL
    https://idcs-xxxx.identity.oraclecloud.com Identity domain URL
    CLIENT_ID
    your-client-id OAuth 2.0 client ID
    CLIENT_SECRET
    your-client-secret OAuth 2.0 client secret
    OAUTH_SCOPE
    urn:opc:resource:fusion:podname:boss/ OAuth scope for Fusion Applications
    LOOKBACK_HOURS
    24 Initial lookback period
    PAGE_SIZE
    100 Records per page
  10. In the Variables & Secretssection, scroll down to Requests:

    • Request timeout: Enter 600 seconds (10 minutes)
  11. Go to the Settingstab:

    • In the Resourcessection:
      • Memory: Select 512 MiBor higher
      • CPU: Select 1
  12. In the Revision scalingsection:

    • Minimum number of instances: Enter 0
    • Maximum number of instances: Enter 100
  13. Click Create.

  14. Wait for the service to be created (1-2 minutes).

  15. After the service is created, the inline code editorwill open automatically.

Add function code

  1. Enter mainin the Entry pointfield.
  2. In the inline code editor, create two files:

    • main.py:
      import 
      
     functions_framework 
     from 
      
     google.cloud 
      
     import 
      storage 
     
     import 
      
     json 
     import 
      
     os 
     import 
      
     urllib3 
     from 
      
     datetime 
      
     import 
     datetime 
     , 
     timezone 
     , 
     timedelta 
     import 
      
     time 
     import 
      
     base64 
     import 
      
     urllib.parse 
     http 
     = 
     urllib3 
     . 
     PoolManager 
     ( 
     timeout 
     = 
     urllib3 
     . 
     Timeout 
     ( 
     connect 
     = 
     10.0 
     , 
     read 
     = 
     60.0 
     ), 
     retries 
     = 
     False 
     , 
     ) 
     storage_client 
     = 
      storage 
     
     . 
      Client 
     
     () 
     GCS_BUCKET 
     = 
     os 
     . 
     environ 
     . 
     get 
     ( 
     'GCS_BUCKET' 
     ) 
     GCS_PREFIX 
     = 
     os 
     . 
     environ 
     . 
     get 
     ( 
     'GCS_PREFIX' 
     , 
     'oracle-fusion-audit' 
     ) 
     STATE_KEY 
     = 
     os 
     . 
     environ 
     . 
     get 
     ( 
     'STATE_KEY' 
     , 
     'oracle-fusion-audit/state.json' 
     ) 
     FUSION_HOST 
     = 
     os 
     . 
     environ 
     . 
     get 
     ( 
     'FUSION_HOST' 
     , 
     '' 
     ) 
     . 
     strip 
     () 
     IDENTITY_DOMAIN_URL 
     = 
     os 
     . 
     environ 
     . 
     get 
     ( 
     'IDENTITY_DOMAIN_URL' 
     , 
     '' 
     ) 
     . 
     rstrip 
     ( 
     '/' 
     ) 
     CLIENT_ID 
     = 
     os 
     . 
     environ 
     . 
     get 
     ( 
     'CLIENT_ID' 
     ) 
     CLIENT_SECRET 
     = 
     os 
     . 
     environ 
     . 
     get 
     ( 
     'CLIENT_SECRET' 
     ) 
     OAUTH_SCOPE 
     = 
     os 
     . 
     environ 
     . 
     get 
     ( 
     'OAUTH_SCOPE' 
     , 
     '' 
     ) 
     LOOKBACK_HOURS 
     = 
     int 
     ( 
     os 
     . 
     environ 
     . 
     get 
     ( 
     'LOOKBACK_HOURS' 
     , 
     '24' 
     )) 
     PAGE_SIZE 
     = 
     int 
     ( 
     os 
     . 
     environ 
     . 
     get 
     ( 
     'PAGE_SIZE' 
     , 
     '100' 
     )) 
     @functions_framework 
     . 
     cloud_event 
     def 
      
     main 
     ( 
     cloud_event 
     ): 
     if 
     not 
     all 
     ([ 
     GCS_BUCKET 
     , 
     FUSION_HOST 
     , 
     IDENTITY_DOMAIN_URL 
     , 
     CLIENT_ID 
     , 
     CLIENT_SECRET 
     ]): 
     print 
     ( 
     'Error: Missing required environment variables' 
     ) 
     return 
     try 
     : 
     bucket 
     = 
     storage_client 
     . 
      bucket 
     
     ( 
     GCS_BUCKET 
     ) 
     state 
     = 
     load_state 
     ( 
     bucket 
     ) 
     now 
     = 
     datetime 
     . 
     now 
     ( 
     timezone 
     . 
     utc 
     ) 
     if 
     isinstance 
     ( 
     state 
     , 
     dict 
     ) 
     and 
      state 
     
     . 
     get 
     ( 
     'last_event_time' 
     ): 
     try 
     : 
     last_val 
     = 
     state 
     [ 
     'last_event_time' 
     ] 
     if 
     last_val 
     . 
     endswith 
     ( 
     'Z' 
     ): 
     last_val 
     = 
     last_val 
     [: 
     - 
     1 
     ] 
     + 
     '+00:00' 
     last_time 
     = 
     datetime 
     . 
     fromisoformat 
     ( 
     last_val 
     ) 
     last_time 
     = 
     last_time 
     - 
     timedelta 
     ( 
     minutes 
     = 
     2 
     ) 
     except 
     Exception 
     as 
     e 
     : 
     print 
     ( 
     f 
     "Warning: Could not parse last_event_time: 
     { 
     e 
     } 
     " 
     ) 
     last_time 
     = 
     now 
     - 
     timedelta 
     ( 
     hours 
     = 
     LOOKBACK_HOURS 
     ) 
     else 
     : 
     last_time 
     = 
     now 
     - 
     timedelta 
     ( 
     hours 
     = 
     LOOKBACK_HOURS 
     ) 
     print 
     ( 
     f 
     "Fetching logs from 
     { 
     last_time 
     . 
     isoformat 
     () 
     } 
     to 
     { 
     now 
     . 
     isoformat 
     () 
     } 
     " 
     ) 
     token 
     = 
     get_oauth_token 
     () 
     if 
     not 
     token 
     : 
     print 
     ( 
     "Error: Failed to obtain OAuth access token" 
     ) 
     return 
     all_records 
     = 
     [] 
     newest_time 
     = 
     None 
     current_start 
     = 
     last_time 
     while 
     current_start 
    < now 
     : 
     chunk_end 
     = 
     min 
     ( 
     current_start 
     + 
     timedelta 
     ( 
     days 
     = 
     30 
     ), 
     now 
     ) 
     records 
     , 
     chunk_newest 
     = 
     fetch_audit_history 
     ( 
     token 
     , 
     current_start 
     , 
     chunk_end 
     ) 
     all_records 
     . 
     extend 
     ( 
     records 
     ) 
     if 
     chunk_newest 
     and 
     ( 
     newest_time 
     is 
     None 
     or 
     chunk_newest 
    > newest_time 
     ): 
     newest_time 
     = 
     chunk_newest 
     current_start 
     = 
     chunk_end 
     if 
     not 
     all_records 
     : 
     print 
     ( 
     "No new audit records found." 
     ) 
     save_state 
     ( 
     bucket 
     , 
     now 
     . 
     isoformat 
     ()) 
     return 
     timestamp 
     = 
     now 
     . 
     strftime 
     ( 
     '%Y%m 
     %d 
     _%H%M%S' 
     ) 
     object_key 
     = 
     f 
     " 
     { 
     GCS_PREFIX 
     } 
     /oracle_fusion_audit_ 
     { 
     timestamp 
     } 
     .ndjson" 
     blob 
     = 
     bucket 
     . 
     blob 
     ( 
     object_key 
     ) 
     ndjson 
     = 
     ' 
     \n 
     ' 
     . 
     join 
     ( 
     [ 
     json 
     . 
     dumps 
     ( 
     r 
     , 
     ensure_ascii 
     = 
     False 
     , 
     default 
     = 
     str 
     ) 
     for 
     r 
     in 
     all_records 
     ] 
     ) 
     + 
     ' 
     \n 
     ' 
     blob 
     . 
      upload_from_string 
     
     ( 
     ndjson 
     , 
     content_type 
     = 
     'application/x-ndjson' 
     ) 
     print 
     ( 
     f 
     "Wrote 
     { 
     len 
     ( 
     all_records 
     ) 
     } 
     records to gs:// 
     { 
     GCS_BUCKET 
     } 
     / 
     { 
     object_key 
     } 
     " 
     ) 
     if 
     newest_time 
     : 
     save_state 
     ( 
     bucket 
     , 
     newest_time 
     ) 
     else 
     : 
     save_state 
     ( 
     bucket 
     , 
     now 
     . 
     isoformat 
     ()) 
     print 
     ( 
     f 
     "Successfully processed 
     { 
     len 
     ( 
     all_records 
     ) 
     } 
     records" 
     ) 
     except 
     Exception 
     as 
     e 
     : 
     print 
     ( 
     f 
     'Error processing logs: 
     { 
     str 
     ( 
     e 
     ) 
     } 
     ' 
     ) 
     raise 
     def 
      
     get_oauth_token 
     (): 
     token_url 
     = 
     f 
     " 
     { 
     IDENTITY_DOMAIN_URL 
     } 
     /oauth2/v1/token" 
     auth_string 
     = 
     f 
     " 
     { 
     CLIENT_ID 
     } 
     : 
     { 
     CLIENT_SECRET 
     } 
     " 
     auth_bytes 
     = 
     auth_string 
     . 
     encode 
     ( 
     'utf-8' 
     ) 
     auth_b64 
     = 
     base64 
     . 
     b64encode 
     ( 
     auth_bytes 
     ) 
     . 
     decode 
     ( 
     'utf-8' 
     ) 
     body 
     = 
     f 
     "grant_type=client_credentials&scope= 
     { 
     urllib 
     . 
     parse 
     . 
     quote 
     ( 
     OAUTH_SCOPE 
     , 
      
     safe 
     = 
     '' 
     ) 
     } 
     " 
     try 
     : 
     response 
     = 
     http 
     . 
     request 
     ( 
     'POST' 
     , 
     token_url 
     , 
     body 
     = 
     body 
     . 
     encode 
     ( 
     'utf-8' 
     ), 
     headers 
     = 
     { 
     'Authorization' 
     : 
     f 
     'Basic 
     { 
     auth_b64 
     } 
     ' 
     , 
     'Content-Type' 
     : 
     'application/x-www-form-urlencoded;charset=UTF-8' 
     , 
     } 
     ) 
     if 
     response 
     . 
     status 
     != 
     200 
     : 
     print 
     ( 
     f 
     "OAuth token request failed: 
     { 
     response 
     . 
     status 
     } 
     " 
     ) 
     print 
     ( 
     f 
     "Response: 
     { 
     response 
     . 
     data 
     . 
     decode 
     ( 
     'utf-8' 
     ) 
     } 
     " 
     ) 
     return 
     None 
     token_data 
     = 
     json 
     . 
     loads 
     ( 
     response 
     . 
     data 
     . 
     decode 
     ( 
     'utf-8' 
     )) 
     print 
     ( 
     "Successfully obtained OAuth access token" 
     ) 
     return 
     token_data 
     . 
     get 
     ( 
     'access_token' 
     ) 
     except 
     Exception 
     as 
     e 
     : 
     print 
     ( 
     f 
     "Error obtaining OAuth token: 
     { 
     e 
     } 
     " 
     ) 
     return 
     None 
     def 
      
     fetch_audit_history 
     ( 
     token 
     , 
     start_time 
     , 
     end_time 
     ): 
     base_url 
     = 
     f 
     "https:// 
     { 
     FUSION_HOST 
     } 
     /fscmRestApi/fndAuditRESTService/audittrail/getaudithistory" 
     headers 
     = 
     { 
     'Authorization' 
     : 
     f 
     'Bearer 
     { 
     token 
     } 
     ' 
     , 
     'Content-Type' 
     : 
     'application/json' 
     , 
     'Accept' 
     : 
     'application/json' 
     , 
     } 
     from_date 
     = 
     start_time 
     . 
     strftime 
     ( 
     '%Y-%m- 
     %d 
     %H:%M:%S' 
     ) 
     to_date 
     = 
     end_time 
     . 
     strftime 
     ( 
     '%Y-%m- 
     %d 
     %H:%M:%S' 
     ) 
     records 
     = 
     [] 
     newest_time 
     = 
     None 
     page_num 
     = 
     1 
     backoff 
     = 
     1.0 
     while 
     True 
     : 
     request_body 
     = 
     { 
     'fromDate' 
     : 
     from_date 
     , 
     'toDate' 
     : 
     to_date 
     , 
     'eventType' 
     : 
     'all' 
     , 
     'pageNumber' 
     : 
     str 
     ( 
     page_num 
     ), 
     'pageSize' 
     : 
     str 
     ( 
     PAGE_SIZE 
     ), 
     'includeAttributes' 
     : 
     'true' 
     , 
     'attributeDetailMode' 
     : 
     'true' 
     , 
     } 
     try 
     : 
     response 
     = 
     http 
     . 
     request 
     ( 
     'POST' 
     , 
     base_url 
     , 
     body 
     = 
     json 
     . 
     dumps 
     ( 
     request_body 
     ) 
     . 
     encode 
     ( 
     'utf-8' 
     ), 
     headers 
     = 
     headers 
     , 
     ) 
     if 
     response 
     . 
     status 
     == 
     429 
     : 
     retry_after 
     = 
     int 
     ( 
     response 
     . 
     headers 
     . 
     get 
     ( 
     'Retry-After' 
     , 
     str 
     ( 
     int 
     ( 
     backoff 
     )))) 
     print 
     ( 
     f 
     "Rate limited (429). Retrying after 
     { 
     retry_after 
     } 
     s..." 
     ) 
     time 
     . 
     sleep 
     ( 
     retry_after 
     ) 
     backoff 
     = 
     min 
     ( 
     backoff 
     * 
     2 
     , 
     60.0 
     ) 
     continue 
     backoff 
     = 
     1.0 
     if 
     response 
     . 
     status 
     == 
     401 
     : 
     print 
     ( 
     "Token expired, re-authenticating..." 
     ) 
     token 
     = 
     get_oauth_token 
     () 
     if 
     not 
     token 
     : 
     print 
     ( 
     "Error: Failed to refresh OAuth token" 
     ) 
     return 
     records 
     , 
     newest_time 
     headers 
     [ 
     'Authorization' 
     ] 
     = 
     f 
     'Bearer 
     { 
     token 
     } 
     ' 
     continue 
     if 
     response 
     . 
     status 
     != 
     200 
     : 
     print 
     ( 
     f 
     "HTTP Error: 
     { 
     response 
     . 
     status 
     } 
     " 
     ) 
     print 
     ( 
     f 
     "Response: 
     { 
     response 
     . 
     data 
     . 
     decode 
     ( 
     'utf-8' 
     ) 
     } 
     " 
     ) 
     return 
     records 
     , 
     newest_time 
     data 
     = 
     json 
     . 
     loads 
     ( 
     response 
     . 
     data 
     . 
     decode 
     ( 
     'utf-8' 
     )) 
     status 
     = 
     data 
     . 
     get 
     ( 
     'status' 
     , 
     '' 
     ) 
     if 
     status 
     != 
     'SUCCESS' 
     : 
     print 
     ( 
     f 
     "API returned status: 
     { 
     status 
     } 
     " 
     ) 
     return 
     records 
     , 
     newest_time 
     audit_data 
     = 
     data 
     . 
     get 
     ( 
     'auditData' 
     , 
     []) 
     if 
     not 
     audit_data 
     : 
     print 
     ( 
     f 
     "No more audit records (empty page 
     { 
     page_num 
     } 
     )" 
     ) 
     break 
     print 
     ( 
     f 
     "Page 
     { 
     page_num 
     } 
     : Retrieved 
     { 
     len 
     ( 
     audit_data 
     ) 
     } 
     audit events" 
     ) 
     records 
     . 
     extend 
     ( 
     audit_data 
     ) 
     for 
     event 
     in 
     audit_data 
     : 
     try 
     : 
     event_date 
     = 
     event 
     . 
     get 
     ( 
     'date' 
     ) 
     if 
     event_date 
     : 
     if 
     newest_time 
     is 
     None 
     or 
     event_date 
    > newest_time 
     : 
     newest_time 
     = 
     event_date 
     except 
     Exception 
     as 
     e 
     : 
     print 
     ( 
     f 
     "Warning: Could not parse event date: 
     { 
     e 
     } 
     " 
     ) 
     if 
     len 
     ( 
     audit_data 
     ) 
    < PAGE_SIZE 
     : 
     print 
     ( 
     f 
     "Reached last page (size= 
     { 
     len 
     ( 
     audit_data 
     ) 
     } 
     < limit= 
     { 
     PAGE_SIZE 
     } 
     )" 
     ) 
     break 
     page_num 
     += 
     1 
     except 
     Exception 
     as 
     e 
     : 
     print 
     ( 
     f 
     "Error fetching audit history: 
     { 
     e 
     } 
     " 
     ) 
     return 
     records 
     , 
     newest_time 
     print 
     ( 
     f 
     "Retrieved 
     { 
     len 
     ( 
     records 
     ) 
     } 
     total audit records from 
     { 
     page_num 
     } 
     pages" 
     ) 
     return 
     records 
     , 
     newest_time 
     def 
      
     load_state 
     ( 
     bucket 
     ): 
     try 
     : 
     blob 
     = 
     bucket 
     . 
     blob 
     ( 
     STATE_KEY 
     ) 
     if 
     blob 
     . 
     exists 
     (): 
     return 
     json 
     . 
     loads 
     ( 
     blob 
     . 
      download_as_text 
     
     ()) 
     except 
     Exception 
     as 
     e 
     : 
     print 
     ( 
     f 
     "Warning: Could not load state: 
     { 
     e 
     } 
     " 
     ) 
     return 
     {} 
     def 
      
     save_state 
     ( 
     bucket 
     , 
     last_event_time_iso 
     ): 
     try 
     : 
     state 
     = 
     { 
     'last_event_time' 
     : 
     last_event_time_iso 
     , 
     'last_run' 
     : 
     datetime 
     . 
     now 
     ( 
     timezone 
     . 
     utc 
     ) 
     . 
     isoformat 
     () 
     } 
     blob 
     = 
     bucket 
     . 
     blob 
     ( 
     STATE_KEY 
     ) 
     blob 
     . 
      upload_from_string 
     
     ( 
     json 
     . 
     dumps 
     ( 
     state 
     , 
     indent 
     = 
     2 
     ), 
     content_type 
     = 
     'application/json' 
     ) 
     print 
     ( 
     f 
     "Saved state: last_event_time= 
     { 
     last_event_time_iso 
     } 
     " 
     ) 
     except 
     Exception 
     as 
     e 
     : 
     print 
     ( 
     f 
     "Warning: Could not save state: 
     { 
     e 
     } 
     " 
     ) 
     
    
    • requirements.txt:
     functions-framework==3.*
    google-cloud-storage==2.*
    urllib3>=2.0.0 
    
  3. Click Deployto save and deploy the function.

  4. Wait for deployment to complete (2-3 minutes).

Create Cloud Scheduler job

  1. In the GCP Console, go to Cloud Scheduler.
  2. Click Create Job.
  3. Provide the following configuration details:

    Setting Value
    Name oracle-fusion-audit-collector-hourly
    Region Select same region as Cloud Run function
    Frequency 0 * * * * (every hour, on the hour)
    Timezone Select timezone (UTC recommended)
    Target type Pub/Sub
    Topic Select oracle-fusion-audit-trigger
    Message body {} (empty JSON object)
  4. Click Create.

Schedule frequency options

Choose frequency based on log volume and latency requirements:

Frequency Cron Expression Use Case
Every 5 minutes
*/5 * * * * High-volume, low-latency
Every 15 minutes
*/15 * * * * Medium volume
Every hour
0 * * * * Standard (recommended)
Every 6 hours
0 */6 * * * Low volume, batch processing
Daily
0 0 * * * Historical data collection

Test the integration

  1. In the Cloud Schedulerconsole, find your job ( oracle-fusion-audit-collector-hourly ).
  2. Click Force runto trigger the job manually.
  3. Wait a few seconds.
  4. Go to Cloud Run > Services.
  5. Click on oracle-fusion-audit-collector .
  6. Click the Logstab.
  7. Verify the function executed successfully. Look for:

     Fetching logs from YYYY-MM-DDTHH:MM:SS+00:00 to YYYY-MM-DDTHH:MM:SS+00:00
    Successfully obtained OAuth access token
    Page 1: Retrieved X audit events
    Wrote X records to gs://oracle-fusion-audit-logs/oracle-fusion-audit/oracle_fusion_audit_YYYYMMDD_HHMMSS.ndjson
    Successfully processed X records 
    
  8. Go to Cloud Storage > Buckets.

  9. Click on oracle-fusion-audit-logs .

  10. Navigate to the oracle-fusion-audit/ folder.

  11. Verify that a new .ndjson file was created with the current timestamp.

If you see errors in the logs:

  • HTTP 401: Verify the CLIENT_ID and CLIENT_SECRET environment variables are correct and the OAuth application is activated
  • HTTP 403: Verify the Fusion Applications user (matching Client ID) has the FND_VIEW_AUDIT_HISTORY_PRIVprivilege or Fusion Apps Administratorrole
  • HTTP 429: Rate limiting -- the function will automatically retry with exponential backoff
  • API status FAIL: Verify the FUSION_HOST environment variable is correct and the Fusion Applications instance is accessible
  • OAuth token error: Verify the IDENTITY_DOMAIN_URL and OAUTH_SCOPE environment variables are correct

Required API permissions

The OAuth client requires the following permissions:

Permission/Scope Access Level Purpose
FND_VIEW_AUDIT_HISTORY_PRIV
Read Retrieve audit history data from Fusion Applications
Fusion Applications scope
Application Access Fusion Applications REST API resources

Regional endpoints

Oracle Fusion Cloud Applications uses different data center regions. The base URL format varies by region:

Region Data Center Code Example Hostname
US West (Phoenix)
us-phoenix-1 instance.fa.us-phoenix-1.oraclecloud.com
US East (Ashburn)
us-ashburn-1 instance.fa.us-ashburn-1.oraclecloud.com
US Commercial 2
us2 instance.fa.us2.oraclecloud.com
EU West (Frankfurt)
eu-frankfurt-1 instance.fa.eu-frankfurt-1.oraclecloud.com
EU West (Amsterdam)
eu-amsterdam-1 instance.fa.eu-amsterdam-1.oraclecloud.com
UK South (London)
uk-london-1 instance.fa.uk-london-1.oraclecloud.com
Canada Southeast (Toronto)
ca-toronto-1 instance.fa.ca-toronto-1.oraclecloud.com
APAC Southeast (Sydney)
ap-sydney-1 instance.fa.ap-sydney-1.oraclecloud.com
APAC Northeast (Tokyo)
ap-tokyo-1 instance.fa.ap-tokyo-1.oraclecloud.com

Use the hostname that corresponds to your Oracle Fusion Cloud Applications instance region. You can identify your region from the URL displayed when accessing your Fusion Applications environment.

API rate limits

Oracle Fusion Cloud Applications Audit REST API has the following characteristics:

Limit Type Value
Token lifetime 3600 seconds (1 hour)
Audit history query range Maximum 1 month per request
Sign-in/sign-out audit retention 7 days
Transaction audit retention 30-365 days (varies by product)

The Cloud Run function automatically handles OAuth token refresh, pagination, and query range chunking. The function splits time ranges exceeding one month into monthly chunks and handles token expiration with automatic re-authentication.

  1. Go to SIEM Settings > Feeds.
  2. Click Add New Feed.
  3. Click Configure a single feed.
  4. In the Feed namefield, enter a name for the feed (for example, Oracle Fusion Audit Logs ).
  5. Select Google Cloud Storage V2as the Source type.
  6. Select Oracle Fusion Cloud Applicationsas the Log type.
  7. Click Get Service Account. A unique service account email will be displayed. For example:

     chronicle-12345678@chronicle-gcp-prod.iam.gserviceaccount.com 
    
  8. Copy this email address for use in the next step.

  9. Click Next.

  10. Specify values for the following input parameters:

    • Storage bucket URL: Enter the GCS bucket URI with the prefix path:

       gs://oracle-fusion-audit-logs/oracle-fusion-audit/ 
      
    • Source deletion option: Select the deletion option according to your preference:
      • Never: Never deletes any files after transfers (recommended for testing).
      • Delete transferred files: Deletes files after successful transfer.
      • Delete transferred files and empty directories: Deletes files and empty directories after successful transfer.
    • Maximum File Age: Include files modified in the last number of days (default is 180 days)
    • Asset namespace: The asset namespace
    • Ingestion labels: The label to be applied to the events from this feed
  11. Click Next.

  12. Review your new feed configuration in the Finalizescreen, and then click Submit.

The Google SecOps service account needs Storage Object Viewerrole on your GCS bucket.

  1. Go to Cloud Storage > Buckets.
  2. Click on oracle-fusion-audit-logs .
  3. Go to the Permissionstab.
  4. Click Grant access.
  5. Provide the following configuration details:
    • Add principals: Paste the Google SecOps service account email
    • Assign roles: Select Storage Object Viewer
  6. Click Save.

UDM mapping table

Log Field UDM Mapping Logic
type
extensions.auth.type Authentication type
type
metadata.event_type Event type
ipAddress
metadata.event_type
eventID
metadata.product_log_id Product log ID
attributeMap.attribute.value
network.http.user_agent HTTP user agent
ipAddress
principal.asset.ip IP address of the asset associated with the principal
ipAddress
principal.ip IP address of the principal
userID.userDN
principal.user.attribute.labels Labels for user attributes
userID.userDN
principal.user.email_addresses Email addresses of the user
userID.loginID
principal.user.userid User ID
status
security_result.action Security action
oracleECID
target.user.userid User ID of the target

Need more help? Get answers from Community members and Google SecOps professionals.

Create a Mobile Website
View Site in Mobile | Classic
Share by: