Skip to main content

Create Custom Policies

You can create a custom policy through the Lacework Console. This section provides the steps to create a custom Lacework Query Language (LQL) policy, including cloud compliance and cloud activity policies. These steps do not apply to vulnerability, or other types of policies.

For information on LQL, see the LQL documentation. As an alternative to creating a custom policy in the console, you can create them with the Lacework CLI or Lacework API.

Create a New Custom Policy

To create a new LQL policy through the Lacework Console, follow these steps:

  1. Log in to the Lacework Console and navigate to Policies.

    Lacework Console Policies Page with Add Policy button

  2. Click + Add Policy. The New Policy window appears.

    New Policy Window

  3. Specify the parameters for your policy.

    • Title: Name for the new policy that also identifies what the policy does
    • Description: Information about the new policy
    • Alerts: Select the action to take for an event triggered by this policy. You can either send an alert notification or mute the event.
    • Severity: The severity of an event triggered by the policy. Select the level of severity to assign to events triggered by this policy. This allows you to sort and filter based on severity level.
    • Status: Enable or disable this policy with this toggle.

    Missing required fields are indicated with a red error message. You cannot continue with the policy creation until you provide these required parameters. Missing fields error message

  4. Click Save and Continue. The Query window appears.

    Query Window

  5. Specify a query identifier in Query ID for your new policy.

  6. Paste your custom query into the window. Lacework validates your query and presents an error if you enter an invalid or empty query. If you want to erase the pasted query, click the Remove the pasted query icon Remove the pasted query icon.

    To try out a query, you can paste the following query. It checks for unrestricted ingress to TCP port 445.

    source {
    array_to_rows(a.RESOURCE_CONFIG:IpPermissions) as (ip_permissions),
    array_to_rows(ip_permissions:IpRanges) as (ip_ranges)
    filter {
    ip_permissions:IpProtocol = 'tcp'
    and ip_permissions:FromPort = 445
    and ip_permissions:ToPort = 445
    and ip_ranges:CidrIp = ''
    return distinct {

    For more information about LQL policies, see the LQL documentation.

  7. Click Save and Continue. The Context window appears.

  8. Optionally, enter remediation information to display with notifications from this new policy.

    Context Window

  9. Click Save and Continue. A confirmation message appears upon successful creation of your new custom LQL policy.