<account_id> SYS_AUDIT_ARCHIVAL_ADMIN
GET cb-credential-service/api/v2.0/accounts/SYS_AUDIT_ARCHIVAL_ADMIN
{ “account”: { “basicInfo”: { “accountName”: “SYS_AUDIT_ARCHIVAL_ADMIN”, “serviceProviderType”: “ibmcloud”, “serviceProviderCode”: “ibmcloud”, “isActive”: “Active”, “accountType”: “standalone”, “userType”: “system”, “credential_count”: 1 }, “accountId”: “SYS_AUDIT_ARCHIVAL_ADMIN”, “advancedInfo”: { “accountNumber”: “11121” }, “credentials”: [ ] } }
Add the following credentials that you obtained after creating object storage toPUT cb-credential-service/api/v2.0/accounts/SYS_AUDIT_ARCHIVAL_ADMIN
{ "credentialName": "SYS_AUDIT_ARCHIVAL_ADMIN", "status": "Active", "passwordFields": { "apikey": <apikey>, "authEndpoint": "https://iam.bluemix.net/oidc/token", "bucketName": <bucketName>, "endpoint": <endpoint>, "resourceInstanceId": <resourceInstanceId>, "serviceName": "s3" } }
Expected response (default policy stored):GET: core/audit/api/v2.1/archivePolicies/policy
{ "policy_type": "auditlog_archival_policy", "format": "ZIP", "periodicity": "WEEKLY", "startAt": "Y:Q:1M:6W-00:00:01", "recordsPerArchive": 100000, "retentionPolicy": { "hotRetentionPeriod": 30, "hotRetentionCount": 500000 }, "archiveEndpoint": { "type": "object_storage", "credentials": "SYS_AUDIT_ARCHIVAL_ADMIN" } }
POST core/audit/api/v2.1/archiveUntil
{ "archiveUntil":"2020-04-27T18:29:59Z", "mode":"manual", "filename":"05082020948AM" }
{ "message":"Audit archival Successful. Created Archive File M-5e9fe41b8a2291000160fd0c-05082020948AM- 1587738195000-1588012199000.zip", "translateCode":"CO_AUDIT_ARCHIVAL_SUCCESSFUL","translateParameters": ["M-5e9fe41b8a2291000160fd0c-05082020948AM- 1587738195000-1588012199000.zip"], "job_id":"677e31b8-65a4-4a91-9558-fd74f9bcb001" }
{ "message":"User 5ea1423463343f135c6584d5 cannot access route /core/audit/api/v2.1/archiveUntil", "translateCode":"CO401UNAUTHORIZED_ROUTE_ACCESS", "translateParameters":["5ea1423463343f135c6584d5", "/core/audit/api/v2.1/archiveUntil"] }
{ "message": "{"message": "Archival Failed. Error in creating the archive file due to error ::400 Bad Request: Credentials not found in system account", "translateCode": "CO_ARCHIVAL_FAILED", "translateParameters": ["400 Bad Request: Credentials not found in system account"]}", "job_id": "b6903e1d-f7ed-4914-85d2-0b94665d89de" }
{ "message": "{"message": "Archival Failed. Error in creating the archive file due to error:: 400 Bad Request: Error when retrieving credentials from https://iam.bluemix.net/oidc/token: HttpCode(400) - Retrieval of tokens from server failed.", "translateCode": "CO_ARCHIVAL_FAILED", "translateParameters": ["400 Bad Request: Error when retrieving credentials from https://iam.bluemix.net/oidc/token: HttpCode(400) - Retrieval of tokens from server failed."]}", "job_id": "475a5538-c8fe-4348-9139-26ed6ad39ccd" }
{ "message": "{"message": "Archival Failed. Error in creating the archive file due to error ::400 Bad Request: Unable to fetch the account details\", "translateCode": "CO_ARCHIVAL_FAILED", "translateParameters": ["400 Bad Request: Unable to fetch the account details"]}", "job_id": "dfb46d3c-53fb-4cbb-b55a-05ca7a341951" }
{ "message": { "message": "{"message": "Audit archival process failed at ARCHIVE_INITIATED stage. No archive policy found!!", "translateCode": "CO400_AUDIT_ARCHIVAL_INITIATION_FAILED", "translateParameters": []}", "job_id": "91a725e5-c008-4a31-94b7-73d362dac615" } }
PATCH core/audit/api/v2.1/archives/archiveId
{ "action":"markComplete" }
{ "action":"reStart" }
Purged audit logs successfully, Audit archival job completed.
Archive stage | Status | Is error possible | Restart allowed |
---|---|---|---|
ARCHIVE_INITIATED | In Progress | Yes | Yes |
ARCHIVE_GENERATED | In Progress | Yes | Yes |
ARCHIVE_STORED | In Progress | Yes | No |
ARCHIVE_PURGED | Completed | No | No |
GET: /core/audit/api/v2.1/archives/{job_id}
{ "startTimeStamp": 1587738195000, "archivedBy": "5e9fe4f264c0eb95c1c0cf47", "archiveInitiatedDate": 1588931313000, "endTimeStamp": 1588012199000, "archiveStageStatus": "COMPLETED", "archiveStatus": "ARCHIVE_PURGED", "archiveJobsOverallStatus": "COMPLETED", "mode": "manual", "userInputFileName": "05082020948AM", "statusLastUpdatedAt": [ "2020-05-08T09:48:36Z" ], "moreInfo": "", "CRC": "db28cc0adb87eb6e7782a802c087afb8", "archiveId": "677e31b8-65a4-4a91-9558-fd74f9bcb001", "details": { "fileName": "M-5e9fe41b8a2291000160fd0c-05082020948AM-1587738195000-1588012199000.zip", "fileLocation": "/www/app/audit_archives/M-5e9fe41b8a2291000160fd0c-05082020948AM-1587738195000-1588012199000.zip", "filePassword": <filePassword>, "fileContents": [ "/www/app/audit_archives/M-5e9fe41b8a2291000160fd0c-05082020948AM-1587738195000-1588012199000-1.json" ], "fileSize": "8.6 KB" }, "doc_type": "archive_file_details" }
AUDIT_ARCHIVAL_POLICY = { "policy_type": "auditlog_archival_policy", "format": "ZIP", "periodicity": "WEEKLY", "startAt": "Y:Q:1M:6W-00:00:01", "recordsPerArchive": 100000, "retentionPolicy": { "hotRetentionPeriod": 30, "hotRetentionCount": 500000 }, "archiveEndpoint": { "type": "object_storage", "credentials": "SYS_AUDIT_ARCHIVAL_ADMIN" } }
PUT: core/audit/api/v2.1/archivePolicies/policy
"message": "Successfully updated audit policy!!!!", "translateCode": "CO200_UPDATED_AUDIT_ARCHIVE_POLICY", "translateParameters": []
"errors": { "startAt": "'startAt' is a required property" }, "message": "Input payload validation failed"
"errors": { "retentionPolicy.hotRetentionCount": "'hotRetentionCount' is a required property", "retentionPolicy.hotRetentionPeriod": "'hotRetentionPeriod' is a required property" }, "message": "Input payload validation failed"
POST: cb-credential-service/api/v2.0/accounts
{ "account": { "basicInfo": { "accountName": "SYS_AUDIT_ARCHIVAL_ADMIN", "serviceProviderType": "ibmcloud", "serviceProviderCode": "ibmcloud", "isActive": "Active", "accountType": "standalone", "userType": "system", "credential_count": 1 }, "accountId": "SYS_AUDIT_ARCHIVAL_ADMIN", "advancedInfo": { "accountNumber": "11121" }, "credentials": [{ "credentialName": "SYS_AUDIT_ARCHIVAL_ADMIN", "status": "Active", "passwordFields": { "apikey": "<api_key>", "authEndpoint": "https://iam.bluemix.net/oidc/token", "bucketName": "testbucketcorex", "endpoint": "https://s3.us-east.cloud-object-storage.appdomain.cloud", "resourceInstanceId": "<resourceInstanceId>", "serviceName": "s3" }, "purpose": [ "systemIntegration" ], "context": [{ "org": [ "org_all" ] }] }] } }
{ "message": "Successfully updated Account bearing id SYS_AUDIT_ARCHIVAL_ADMIN", "statusCode": 200, "translateCode": "CO200_SUCCESSFULLY_UPDATE_ACC_BEARING_ID", "translateParameters": [ "SYS_AUDIT_ARCHIVAL_ADMIN" ] }
Attribute | Values |
---|---|
apikey | api_key |
bucketName | testbucket |
endpoint | s3.us-east.cloud-object-storage.appdomain.cloud |
resourceInstanceId | crn:v1:bluemix:public:cloud-object-storage:global:a/abcd:xyz:: |
serviceName | s3 |