For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/es/api/latest/sensitive-data-scanner/create-scanning-rule.md. A documentation index is available at /llms.txt.
Language
Datadog site

Crear regla de análisis

POSThttps://api.datadoghq.com/api/v2/sensitive-data-scanner/config/ruleshttps://api.us3.datadoghq.com/api/v2/sensitive-data-scanner/config/ruleshttps://api.us5.datadoghq.com/api/v2/sensitive-data-scanner/config/ruleshttps://api.datadoghq.eu/api/v2/sensitive-data-scanner/config/ruleshttps://api.ap1.datadoghq.com/api/v2/sensitive-data-scanner/config/ruleshttps://api.ap2.datadoghq.com/api/v2/sensitive-data-scanner/config/ruleshttps://api.uk1.datadoghq.com/api/v2/sensitive-data-scanner/config/ruleshttps://api.ddog-gov.com/api/v2/sensitive-data-scanner/config/ruleshttps://api.us2.ddog-gov.com/api/v2/sensitive-data-scanner/config/rules

Descripción general

Crea una regla de análisis en un grupo de análisis de datos confidenciales, ordenada en último lugar. La regla publicada DEBE incluir una relación de grupo. DEBE incluir una relación standard_pattern o un atributo de expresión regular, pero no ambos. Si included_attributes está vacío o falta, analizaremos todos los atributos excepto excluded_attributes. Si faltan ambos, analizaremos todo el evento.

This endpoint requires the data_scanner_write permission.

Solicitud

Body Data (required)

Campo
Type
Descripción
data [required]
object

Crea una solicitud de regla.

meta [required]
object

Meta payload containing information about the API.

Respuesta

OK

Create rule response.

Campo
Type
Descripción
data
object

Response data related to the creation of a rule.

meta
object

Meta payload containing information about the API.

Ejemplo de código

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/sensitive-data-scanner/config/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "excluded_namespaces": [
        "admin.name"
      ],
      "included_keyword_configuration": {
        "character_count": 30,
        "keywords": [
          "email",
          "address",
          "login"
        ]
      },
      "is_enabled": true,
      "namespaces": [
        "admin"
      ],
      "suppressions": {
        "ends_with": [
          "@example.com",
          "another.example.com"
        ],
        "exact_match": [
          "admin@example.com",
          "user@example.com"
        ],
        "starts_with": [
          "admin",
          "user"
        ]
      },
      "tags": [
        "sensitive_data:true"
      ],
      "text_replacement": {
        "type": "none"
      }
    },
    "relationships": {
      "group": {
        "data": {
          "type": "sensitive_data_scanner_group"
        }
      },
      "standard_pattern": {
        "data": {
          "type": "sensitive_data_scanner_standard_pattern"
        }
      }
    },
    "type": "sensitive_data_scanner_rule"
  },
  "meta": {
    "version": 0
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/sensitive-data-scanner/config/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "excluded_namespaces": [
        "admin.name"
      ],
      "included_keyword_configuration": {
        "character_count": 30,
        "keywords": [
          "email",
          "address",
          "login"
        ]
      },
      "is_enabled": true,
      "namespaces": [
        "admin"
      ],
      "suppressions": {
        "ends_with": [
          "@example.com",
          "another.example.com"
        ],
        "exact_match": [
          "admin@example.com",
          "user@example.com"
        ],
        "starts_with": [
          "admin",
          "user"
        ]
      },
      "tags": [
        "sensitive_data:true"
      ],
      "text_replacement": {
        "type": "none"
      }
    },
    "relationships": {
      "group": {
        "data": {
          "type": "sensitive_data_scanner_group"
        }
      },
      "standard_pattern": {
        "data": {
          "type": "sensitive_data_scanner_standard_pattern"
        }
      }
    },
    "type": "sensitive_data_scanner_rule"
  },
  "meta": {
    "version": 0
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/sensitive-data-scanner/config/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "excluded_namespaces": [
        "admin.name"
      ],
      "included_keyword_configuration": {
        "character_count": 30,
        "keywords": [
          "email",
          "address",
          "login"
        ]
      },
      "is_enabled": true,
      "namespaces": [
        "admin"
      ],
      "suppressions": {
        "ends_with": [
          "@example.com",
          "another.example.com"
        ],
        "exact_match": [
          "admin@example.com",
          "user@example.com"
        ],
        "starts_with": [
          "admin",
          "user"
        ]
      },
      "tags": [
        "sensitive_data:true"
      ],
      "text_replacement": {
        "type": "none"
      }
    },
    "relationships": {
      "group": {
        "data": {
          "type": "sensitive_data_scanner_group"
        }
      },
      "standard_pattern": {
        "data": {
          "type": "sensitive_data_scanner_standard_pattern"
        }
      }
    },
    "type": "sensitive_data_scanner_rule"
  },
  "meta": {
    "version": 0
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/sensitive-data-scanner/config/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "excluded_namespaces": [
        "admin.name"
      ],
      "included_keyword_configuration": {
        "character_count": 30,
        "keywords": [
          "email",
          "address",
          "login"
        ]
      },
      "is_enabled": true,
      "namespaces": [
        "admin"
      ],
      "suppressions": {
        "ends_with": [
          "@example.com",
          "another.example.com"
        ],
        "exact_match": [
          "admin@example.com",
          "user@example.com"
        ],
        "starts_with": [
          "admin",
          "user"
        ]
      },
      "tags": [
        "sensitive_data:true"
      ],
      "text_replacement": {
        "type": "none"
      }
    },
    "relationships": {
      "group": {
        "data": {
          "type": "sensitive_data_scanner_group"
        }
      },
      "standard_pattern": {
        "data": {
          "type": "sensitive_data_scanner_standard_pattern"
        }
      }
    },
    "type": "sensitive_data_scanner_rule"
  },
  "meta": {
    "version": 0
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/sensitive-data-scanner/config/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "excluded_namespaces": [
        "admin.name"
      ],
      "included_keyword_configuration": {
        "character_count": 30,
        "keywords": [
          "email",
          "address",
          "login"
        ]
      },
      "is_enabled": true,
      "namespaces": [
        "admin"
      ],
      "suppressions": {
        "ends_with": [
          "@example.com",
          "another.example.com"
        ],
        "exact_match": [
          "admin@example.com",
          "user@example.com"
        ],
        "starts_with": [
          "admin",
          "user"
        ]
      },
      "tags": [
        "sensitive_data:true"
      ],
      "text_replacement": {
        "type": "none"
      }
    },
    "relationships": {
      "group": {
        "data": {
          "type": "sensitive_data_scanner_group"
        }
      },
      "standard_pattern": {
        "data": {
          "type": "sensitive_data_scanner_standard_pattern"
        }
      }
    },
    "type": "sensitive_data_scanner_rule"
  },
  "meta": {
    "version": 0
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/sensitive-data-scanner/config/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "excluded_namespaces": [
        "admin.name"
      ],
      "included_keyword_configuration": {
        "character_count": 30,
        "keywords": [
          "email",
          "address",
          "login"
        ]
      },
      "is_enabled": true,
      "namespaces": [
        "admin"
      ],
      "suppressions": {
        "ends_with": [
          "@example.com",
          "another.example.com"
        ],
        "exact_match": [
          "admin@example.com",
          "user@example.com"
        ],
        "starts_with": [
          "admin",
          "user"
        ]
      },
      "tags": [
        "sensitive_data:true"
      ],
      "text_replacement": {
        "type": "none"
      }
    },
    "relationships": {
      "group": {
        "data": {
          "type": "sensitive_data_scanner_group"
        }
      },
      "standard_pattern": {
        "data": {
          "type": "sensitive_data_scanner_standard_pattern"
        }
      }
    },
    "type": "sensitive_data_scanner_rule"
  },
  "meta": {
    "version": 0
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/sensitive-data-scanner/config/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "excluded_namespaces": [
        "admin.name"
      ],
      "included_keyword_configuration": {
        "character_count": 30,
        "keywords": [
          "email",
          "address",
          "login"
        ]
      },
      "is_enabled": true,
      "namespaces": [
        "admin"
      ],
      "suppressions": {
        "ends_with": [
          "@example.com",
          "another.example.com"
        ],
        "exact_match": [
          "admin@example.com",
          "user@example.com"
        ],
        "starts_with": [
          "admin",
          "user"
        ]
      },
      "tags": [
        "sensitive_data:true"
      ],
      "text_replacement": {
        "type": "none"
      }
    },
    "relationships": {
      "group": {
        "data": {
          "type": "sensitive_data_scanner_group"
        }
      },
      "standard_pattern": {
        "data": {
          "type": "sensitive_data_scanner_standard_pattern"
        }
      }
    },
    "type": "sensitive_data_scanner_rule"
  },
  "meta": {
    "version": 0
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/sensitive-data-scanner/config/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "excluded_namespaces": [
        "admin.name"
      ],
      "included_keyword_configuration": {
        "character_count": 30,
        "keywords": [
          "email",
          "address",
          "login"
        ]
      },
      "is_enabled": true,
      "namespaces": [
        "admin"
      ],
      "suppressions": {
        "ends_with": [
          "@example.com",
          "another.example.com"
        ],
        "exact_match": [
          "admin@example.com",
          "user@example.com"
        ],
        "starts_with": [
          "admin",
          "user"
        ]
      },
      "tags": [
        "sensitive_data:true"
      ],
      "text_replacement": {
        "type": "none"
      }
    },
    "relationships": {
      "group": {
        "data": {
          "type": "sensitive_data_scanner_group"
        }
      },
      "standard_pattern": {
        "data": {
          "type": "sensitive_data_scanner_standard_pattern"
        }
      }
    },
    "type": "sensitive_data_scanner_rule"
  },
  "meta": {
    "version": 0
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/sensitive-data-scanner/config/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "excluded_namespaces": [
        "admin.name"
      ],
      "included_keyword_configuration": {
        "character_count": 30,
        "keywords": [
          "email",
          "address",
          "login"
        ]
      },
      "is_enabled": true,
      "namespaces": [
        "admin"
      ],
      "suppressions": {
        "ends_with": [
          "@example.com",
          "another.example.com"
        ],
        "exact_match": [
          "admin@example.com",
          "user@example.com"
        ],
        "starts_with": [
          "admin",
          "user"
        ]
      },
      "tags": [
        "sensitive_data:true"
      ],
      "text_replacement": {
        "type": "none"
      }
    },
    "relationships": {
      "group": {
        "data": {
          "type": "sensitive_data_scanner_group"
        }
      },
      "standard_pattern": {
        "data": {
          "type": "sensitive_data_scanner_standard_pattern"
        }
      }
    },
    "type": "sensitive_data_scanner_rule"
  },
  "meta": {
    "version": 0
  }
}
EOF