This page describes two methods for exporting Security Command Center data, including assets, findings, and security marks:
You can export Security Command Center data by using the Google Cloud console, the Google Cloud CLI, or the Security Command Center API.
You can also stream findings to BigQuery. For more information, see Stream findings to BigQuery for analysis.
One-time exportsOne-time exports let you manually transfer and download current and historical findings and assets.
For findings, you can use the Google Cloud console to transfer data in JSON, JSONL, or CSV format to a Cloud Storage bucket. You can also download a limited number of findings to your workstation in CSV format.
For assets, you can download the data from the Google Cloud console to your local workstation as a CSV file.
PermissionsTo perform one-time exports, you need the following:
The Identity and Access Management (IAM) role Security Center Admin Viewer (roles/securitycenter.adminViewer
), or any role that has the following permissions:
resourcemanager.organizations.get
(required only for organization-level activations of Security Command Center)resourcemanager.projects.get
(required for project-level activations of Security Command Center)securitycenter.assets.group
securitycenter.assets.list
securitycenter.findings.group
securitycenter.findings.list
securitycenter.sources.get
securitycenter.sources.list
securitycenter.userinterfacemetadata.get
The Storage Admin role, which lets you store data in Cloud Storage buckets.
The IAM roles for Security Command Center can be granted at the organization, folder, or project level. Your ability to view, edit, create, or update findings, assets, and security sources depends on the level for which you are granted access. To learn more about Security Command Center roles, see Access control.
Data residency and one-time exportsYou cannot include any of your data that is subject to data residency control in the filter of a one-time export to Cloud Storage.
If you specify a property that contains controlled data in the finding filter, Security Command Center returns an error message when you attempt the export.
Export data using the Google Cloud consoleUsing the Google Cloud console, you can do the following:
This section describes how to export Security Command Center data to a Cloud Storage bucket. When you click Export on the Findings page in the Google Cloud console, Security Command Center automatically gets credentials or permissions to write to the Cloud Storage bucket.
Findings are exported in separate operations. You can export a JSON file, a JSONL file, or a CSV file to an existing Cloud Storage bucket or create a bucket during the export process. You can export all current findings, or select the filters you want to use before you export.
You can't export findings to a Cloud Storage bucket that has the retention policy set.
In the Google Cloud console, go to the Security Command Center Findings page.
On the toolbar, click the arrow_drop_down project selector, and select your project, folder, or organization.
Select the findings that you need to export by applying filters to the findings query. For more information about creating filters, see Find and view specific findings.
When you're done creating a filter, click Export, and then, under One-time, click Cloud storage.
On the Export page, configure the export:
If you selected an existing file in the bucket, the Confirm Overwrite dialog displays.
The configured data is saved to the Cloud Storage bucket that you specified.
Download exported data from a Cloud Storage bucketTo download the exported JSON, JSONL, or CSV data, perform the following steps:
Go to the Storage browser page in the Google Cloud console.
Select your project, and then click the bucket to which you exported data.
Select the checkbox next to the export file, and then click Download.
On the Save File dialog, select the location where you want to save the file, and then click Save.
The JSON, JSONL, or CSV file is downloaded to the location that you specified.
Export findings to a CSV fileTo configure the export, you can filter findings by category, severity, and other properties. All findings that match the filter are included in the CSV file.
You can download up to 1,000 findings directly to your workstation. If the number of findings exceeds 1,000, you are prompted to refine your query to get fewer results. Alternatively, you can export the data to a Cloud Storage bucket.
The finding records are exported with a default set of columns, which might not match what you see in the console. That is, hiding or displaying columns doesn't change which columns are exported. Similarly, changing the number of rows displayed per page—which you can do in the Google Cloud console—has no effect on the exported content.
For information about how to export findings to a CSV file, click the tab specific to your service tier.
Standard or PremiumYou can download asset data to a CSV file from the Assets page in the Google Cloud console.
To download asset data to a CSV file, follow these steps:
In the Google Cloud console, go to the Assets page of Security Command Center.
On the toolbar, click the arrow_drop_down project selector, and select your project, folder, or organization.
Use the Quick filters panel or the Filter field of the asset results panel to select the assets you need to export. For more information about filtering assets, see Filtering assets.
Above the displayed assets, click Export and then Download CSV. The data for the assets in the results panel are downloaded to your workstation.
You can export assets, findings, and security marks to a Cloud Storage bucket or your local workstation by using the Security Command Center API.
Export asset data using API methodsTo export or list asset data, use the Cloud Asset Inventory API. For more information, see Export asset history and metadata.
The asset methods and fields of the Security Command Center API are deprecated and will be removed on or after June 20, 2024.
Until they are removed, users who activated Security Command Center before June 20, 2023 can use the asset methods of the Security Command Center API to list and export asset data, but these methods support only the assets that Security Command Center supports.
For information about using the deprecated asset API methods, see listing assets.
Export finding data using the Security Command Center APITo export findings with the Security Command Center API, follow the guide for listing security findings, and then download or export the API responses.
To list findings with any attached security marks, you can use the following API methods:
organizations.sources.locations.findings.list
folders.sources.locations.findings.list
project.sources.locations.findings.list
The methods return findings with their full set of properties, attributes, and associated marks in JSON format. If your application requires data to be in a different format, you need to write custom code to convert the JSON output.
If you specify a value in the groupBy
field, you can use the following methods to list findings in an organization, folder, or project, grouped by the properties that you specify:
organizations.sources.locations.findings.group
folders.sources.locations.findings.group
projects.sources.locations.findings.group
To use Google Cloud CLI commands in the Cloud Shell to export findings to a Cloud Storage bucket, follow these steps:
Open Cloud Shell.
To write findings to a file, add an output string to the gcloud CLI commands for listing findings.
For example, the following command stores listed findings in a text file named FINDINGS.txt
.
gcloud scc findings list PARENT_ID \ --source=SOURCE_ID \ --location=LOCATION \ --filter="FILTER" > FINDINGS.txt
Replace the following:
FILTER
: An optional expression to limit the list of findings printed to those that match the filter expression.
LOCATION
: the Security Command Center location in which to export findings; if data residency is enabled, use eu
, sa
, or us
; otherwise, use the value global
.PARENT_ID
: the ID of any of the following parent resources:
organizations/ORGANIZATION_ID
or ORGANIZATION_ID
folders/FOLDER_ID
projects/PROJECT_ID
SOURCE_ID
: the source ID for the finding provider. To find a source ID, see Getting the source ID.
FINDINGS.txt
: the name and extension of a target file to store the list of findings.
Copy FINDINGS.txt
to your Cloud Storage bucket.
gcloud storage cp FINDINGS.txt gs://BUCKET_NAME
Replace BUCKET_NAME
with the name of your bucket.
To save FINDINGS.txt
to your local workstation instead of a Cloud Storage bucket, run the following command:
cloudshell download FINDINGS.txt
Continuous exports simplify the process of automatically exporting Security Command Center findings into Pub/Sub. When new findings are written, they are automatically exported to designated Pub/Sub topics in near-real time, letting you integrate them into your existing workflow.
To learn more about Pub/Sub, see What is Pub/Sub?
Security Command Center to BigQuery exportWhen an attribute of a finding is updated in Security Command Center, a snapshot of the finding is taken, and Security Command Center attempts to send that snapshot to BigQuery.
If the attributes of the finding in the snapshot match the export filter defined in the BigQueryExport, the snapshot is sent to BigQuery, where it becomes the current record of the finding in BigQuery.
If the attributes of the finding don't match the filter, the snapshot is not sent to BigQuery. If a previous snapshot of the finding exists in BigQuery, that previous snapshot becomes the current record of the finding in BigQuery, even though the snapshot does not reflect the update to the attribute that occurred in Security Command Center.
For example, if the filter for a BigQuery export contains the active state, a new finding is generated with the active state, and a snapshot of the finding is exported successfully to BigQuery.
Later, the state of that finding in Security Command Center is updated inactive. The update triggers an export of a new snapshot of the finding to BigQuery, but, because the state value no longer matches the filter, the filter blocks the export of the finding snapshot.
Consequently, the snapshot of the finding in BigQuery still has the active state, but the same finding in Security Command Center has the inactive state.
This also results in a mismatch between the number of active findings in Security Command Center and the number of active findings in BigQuery. The number is almost always greater in BigQuery than it is in Security Command Center.
For example, if an export filter specifies the active state and 100 findings are generated with the active state, all 100 get exported to BigQuery. Then later in Security Command Center, 50 of those findings get updated to inactive, and the filter blocks the export triggered by the updates because the state value no longer matches the filter. Consequently, in BigQuery, all 100 of the findings are still active, while in Security Command Center only 50 findings remain active.
Continuous exports versus finding notificationsSecurity Command Center lets you set up finding notifications for Pub/Sub using the Security Command Center API. The API requires you to use Google Cloud CLI to set up Pub/Sub topics, create finding filters, and create NotificationConfigs
, files that contain configuration settings to send notifications. Continuous exports offer the same functionality, but creating exports is simplified by using the Google Cloud console.
To create and manage continuous exports, you need one of the following roles.
roles/securitycenter.adminEditor
roles/securitycenter.adminViewer
You can also use any role that has the following permissions:
To view or publish Pub/Sub topics:
pubsub.topics.publish
pubsub.topics.list
To view the continuous exports page:
securitycenter.notificationconfig.get
securitycenter.notificationconfig.list
To manage continuous exports:
securitycenter.notificationconfig.create
securitycenter.notificationconfig.update
securitycenter.notificationconfig.delete
To learn more about Security Command Center roles, see Access control.
Data residency and continuous exportsIf data residency is enabled for Security Command Center, the configurations that define continuous exports to Pub/Sub—notificationConfig
resources—are subject to data residency control and are stored in a Security Command Center location that you select.
To export findings in a Security Command Center location to Pub/Sub, you must configure the continuous export in the same Security Command Center location as the findings.
Because the filters that are used in continuous exports can contain data that is subject to residency controls, make sure you specify the correct location before you create them. Security Command Center does not restrict which location you create exports in.
Continuous exports are stored only in the location in which they are created and cannot be viewed or edited in other locations.
After you create a continuous export, you can't change its location. To change the location, you need to delete the continuous export and recreate it in the new location.
To learn how to use Security Command Center when data residency is enabled, see Security Command Center regional endpoints.
Compatibility with Pub/Sub message storage policiesPub/Sub lets you set a message storage policy. This policy ensures that Pub/Sub stores and processes messages only in the set of Google Cloud regions that you specify, regardless of where the publish or subscribe requests originate.
However, continuous exports are incompatible with the enforceInTransit
option of message storage policies. When you configure continuous exports, don't choose a Pub/Sub topic that has a message storage policy with enforceInTransit
enabled; such a topic might not receive finding notifications from Security Command Center.
For more information, see Message storage policy overview.
Create a continuous export to Pub/SubContinuous exports let you automate the export of all future findings to Pub/Sub or create filters to export future findings that meet specific criteria. You can filter findings by category, source, asset type, security marks, severity, state, and other variables.
When you create a new continuous export for Pub/Sub, you can manage it with the Google Cloud console; the gcloud CLI; the v2 Security Command Center API; or the v2 client libraries for Security Command Center.
Your organization can create a maximum of 500 continuous exports.
To create an export for Pub/Sub, do the following:
In the Google Cloud console, go to the Findings page of Security Command Center.
On the toolbar, click the arrow_drop_down project selector, and select your project, folder, or organization.
In the Findings query results field, select the findings to export by using either of the following methods:
By clicking Add Filter to select the properties of the findings you need to export.
The Select filter dialog lets you choose supported finding attributes and values.
The dialog closes and your query is updated.
By manually coding the finding query in the query editor. You can use standard SQL operators AND
,OR
, equals (=
), has (:
), and not (-
) to specify the finding properties and values of the findings you need to export.
As you type in your query, an autocomplete menu appears, where you can select filter names and functions.
For example, the following query mutes low-severity and medium-severity anomalous IAM grant
findings in prod-project
, and excludes resource types where the name has the substring compute
:
severity="LOW" OR severity="MEDIUM" AND category="Persistence:
IAM Anomalous Grant" AND resource.project_display_name="prod-project"
AND -resource.type:"compute"
For more examples on filtering findings, see Filtering notifications.
Review the resulting query for accuracy. To make changes, delete or add properties and filter values as needed.
Click Refresh matching findings. A table displays findings that match your query. For more information about querying findings, see Edit a findings query in the Google Cloud console.
Click Export, and then, under Continuous, click Pub/Sub.
Review your filter to ensure it's correct and, if necessary, return to the Findings page to modify it.
Under Continuous export name, enter a name for the export.
Under Continuous export description, enter a description for the export.
Under Export to, select a project for your export. You can't create a project on this page. To create a new project, see Creating a project.
Under Pub/Sub topic, select the topic where you want to export findings. To create a topic, do the following:
Enter a Topic ID, and then select other options as needed:
Click Create Topic.
Click Save. You see a confirmation and are returned to the findings page.
Follow the guide to create a subscription for your Pub/Sub topic.
The Pub/Sub export configuration is complete. To publish notifications, a service account is created for you in the form of service-org-ORGANIZATION_ID@gcp-sa-scc-notification.iam.gserviceaccount.com
. This service account is automatically granted the roles/securitycenter.notificationServiceAgent
role at the organization level. This service account role is required for notifications to function.
To confirm that an export is working, perform the following steps to toggle findings between active and inactive states.
In the Google Cloud console, go to the Findings page of Security Command Center.
Click Edit query. The Query editor opens.
Edit the query so that both so that both active and inactive findings are displayed. The following query omits the state
property to display all findings except those that are muted:
NOT mute="MUTED"
To view, edit, or delete exports, do the following:
In the Google Cloud console, go to the Security Command Center Settings page.
On the toolbar, click the arrow_drop_down project selector, and select your project, folder, or organization.
Select Continuous exports. You see a list of continuous exports for your project, folder, or organization.
In the Google Cloud console, some continuous exports might have a Legacy label, which indicates that they were created with the v1 Security Command Center API. You can manage these continuous exports with the Google Cloud console; the gcloud CLI; the v1 Security Command Center API; or the v1 client libraries for Security Command Center.
To manage these continuous exports with the gcloud CLI, you must not specify a location when you run the gcloud CLI command.
On the Continuous exports page in Settings, you can create, view, edit, and delete continuous exports.
To see findings that match an export filter, do the following:
On the Continuous exports page, next to the name of an export, select More more_vert, and then click View related filters.
The Findings page loads with findings that match the export filter.
Edit continuous exportsLearn more about finding notifications.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4