Skip to main content

Instructor, no.

Incydr Professional, Enterprise, Horizon, and Gov F2, yes.

Incydr Basic, Advanced, and Gov F1, yes.

HOME
GETTING STARTED
RELEASE NOTES
FAQs
APIs
SYSTEM STATUS
Code42 Support

File Metadata Collection exclusions via API

Overview

This article explains how to use the Code42 API to define a list of file types and file paths to exclude from File Metadata Collection monitoring. This helps ensure user devices don't spend resources indexing file metadata for files you're not interested in monitoring. It also prevents irrelevant or unimportant file events from appearing in dashboard visualizations, alerts, and Forensic Search results. The examples in this article use curl, but the concepts apply to any tool you choose for interacting with the Code42 API.

Use the Code42 console
You can use the Code42 console instead of the Code42 API to exclude file types and paths from monitoring. See File event exclusions for details. Using the Code42 console provides a more streamlined and less error-prone experience. 

Considerations

  • Exclusions must be defined in regular expression (regex) format.
  • Exclusions apply to all users and organizations in your Code42 environment.
  • You must have credentials for a Code42 user with the Org Admin or Cross Org Admin role. An Org Admin must be an administrator of the top-level organization.
Code42 Developer Portal
See the Code42 Developer Portal for more API documentation and resources. The portal provides:

Use the Code42 Developer Portal for your API needs as much as possible. APIs in the portal are the preferred way to integrate with Code42 for Incydr users. If you use Code42 APIs that do not appear on the Code42 Developer Portal, contact our Technical Support Engineers for guidance on the best way to integrate with Code42. 

API request details

  • Request URL
    • United States:
      • If you sign in to the Code42 console at https://console.us.code42.com (US1), use: 
        https://console.us.code42.com/api/v1/
      • If you sign in to the Code42 console at https://console.us2.code42.com (US2), use:
        https://console.us2.code42.com/api/v1/
      • If you sign in to the Code42 console for the Code42 federal environment at https://console.gov.code42.com (US3), use: 
        https://console.gov.code42.com/api/v1/
    • Ireland:
      • If you sign in to the Code42 console at https://console.ie.code42.com (EU1), use: 
        https://console.ie.code42.com/api/v1/
  • Resource: OrgSettings
  • Key: 
    • Incydr Basic and Advanced and other plans: device_fileForensics_fileExclusions_org
    • Incydr Professional, Enterprise, Horizon, and Gov F2: artemis_device_fileForensics_fileExclusions_org
  • Methods: GET to view existing exclusions; PUT to add or update exclusions

View and update exclusions

Step 1: Find your top-level OrgID

To view and edit exclusions, you must first identify your top-level organization's numeric ID. 

  1. Sign in to the Code42 console.
  2. Select Administration > Environment > Organizations.
  3. Select Export.
    The list of organizations is downloaded to your device as a CSV file.
  4. Open the downloaded CSV and locate the applicable organization.
  5. Note the numeric ID in the orgID column.

Step 2: View existing exclusions

Use the GET method to view existing exclusions. The OrgSettings resource also contains keys for numerous other Code42 settings. Therefore, to view only the exclusions, you must include the appropriate key as a query parameter.

The example below assumes basic familiarity with curl commands. Use this as a template to create a command specific to your Code42 environment:

Copied!
curl -X GET \
  '<request_url>/api/v1/OrgSettings/<OrgID>?keys=device_fileForensics_fileExclusions_org' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer <auth_token>'
  1. Replace <request_url> with the address of your Code42 environment (do not include the brackets in your request).
  2. Replace <OrgID> with the number identified in Step 1 above (do not include the brackets in your request).
  3. Replace <auth_token> with an authentication token.
  4. For Incydr Professional, Enterprise, Horizon, and Gov F2, change the key from device_fileForensics_fileExclusions_org to artemis_device_fileForensics_fileExclusions_org.
  5. Execute the curl command in your command-line tool of choice. When prompted, enter your password.
    The Code42 API returns the existing exclusions. If no exclusions exist yet, the data object in the response is empty.

Step 3: Update or add new exclusions

Use the PUT method to add or modify exclusions. Before sending any updates, make sure to complete Step 2 above to obtain the list of existing exclusions.

Updates overwrite existing exclusions
The OrgSettings API resource does not automatically add to existing values. All PUT requests completely replace existing values. Therefore, to add to existing exclusions, you must first obtain a list of current exclusions and re-submit that entire list with your new additions.

The steps below assume basic familiarity with curl commands. Use the following example as a template to create a command specific to your Code42 environment.

Copied!
curl -X PUT \
  '<request_url>/api/v1/OrgSettings/<OrgID>' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer <auth_token>' \
  -d '{ 
    "packets": [
        {
            "key": "device_fileForensics_fileExclusions_org",
            "value": {
                "all":[ "'.*cache.*'" ], 
                "macintosh":[ "'.*.db'" ], 
                "windows":[ "'.*.etl'", "'.*.tmp'" ], 
                "linux": [ "'/sys/.*'", "'/proc/.*'" ]
            },
            "locked": true
        }
    ]
}'
  1. Replace <request_url> with the address of your Code42 environment (do not include the brackets in your request).
  2. Replace <OrgID> with the number identified in Step 1 above (do not include the brackets in your request).
  3. Replace <auth_token> with an authentication token.
  4. For Incydr Professional, Enterprise, Horizon, and Gov F2, change the key from device_fileForensics_fileExclusions_org to artemis_device_fileForensics_fileExclusions_org.
  5. Define exclusions with regex for each operating system in use in your Code42 environment. Defining specific exclusions for each operating system minimizes the resources required on user devices. In this example:
    • All devices will exclude files with the .cache extension
    • Mac devices will exclude files with the .db extension
    • Windows devices will exclude files with the .etl and .tmp extension
    • Linux devices will exclude files in the sys and proc directories
  6. Execute the curl command in your command-line tool of choice. When prompted, enter your password.
    A 204 No Content response indicates the Code42 cloud received the request and applied the exclusions to user devices.

Delete all exclusions

Use the DELETE method to remove all exclusions. To prevent inadvertent removal of other system settings, you must include the appropriate key as a query parameter.

Include key parameter to prevent removal of other system settings
To test this request, submit it first as a GET request and make sure the response includes only the device_fileForensics_fileExclusions_org or artemis_device_fileForensics_fileExclusions_org key. Then resubmit it as a DELETE request.

The OrgSetting resource also contains keys for numerous other Code42 settings. Therefore, it is very important to list the correct key as a query parameter in the request URL. Failure to specify the key will cause other system settings to be deleted by this request.

The example below assumes basic familiarity with curl commands. Use this as a template to create a curl command specific to your Code42 environment:

Copied!
curl -X DELETE \
  '<request_url>/api/v1/OrgSettings/<OrgID>?keys=device_fileForensics_fileExclusions_org' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \  
  -H 'Authorization: Bearer <auth_token>'
  1. Replace <request_url> with the address of your Code42 environment (do not include the brackets in your request).
  2. Replace <OrgID> with the number identified in Step 1 above (do not include the brackets in your request).
  3. Replace <auth_token> with an authentication token.
  4. For Incydr Professional, Enterprise, Horizon, and Gov F2, change the key from device_fileForensics_fileExclusions_org to artemis_device_fileForensics_fileExclusions_org.
  5. Execute the curl command in your command-line tool of choice. When prompted, enter your password.
    A 204 No Content response indicates the Code42 cloud received the request and deleted all exclusions.

Related topics

  • Was this article helpful?