Skip to content

Expand v1alpha coverage; Add packaging and a CLI - #188

Open
dandye wants to merge 61 commits into
chronicle:masterfrom
dandye:events_import_v1alpha
Open

Expand v1alpha coverage; Add packaging and a CLI#188
dandye wants to merge 61 commits into
chronicle:masterfrom
dandye:events_import_v1alpha

Conversation

@dandye

@dandyedandye commented Mar 7, 2025

Copy link
Copy Markdown
Contributor

Install the CLI

make install

CLI Commands and Subcommands

# chronicle --help
# top-level subcommands
chronicle detect --help # Detection API commands.
chronicle ingestion --help # Ingestion API commands.
chronicle iocs --help # IoCs API commands.
chronicle lists --help # Lists API commands.
chronicle search --help # Search API commands.
# chronicle detect --help
chronicle detect alerts --help # Alert management commands.
chronicle detect detections --help # Detection management commands.
chronicle detect errors --help # Error management commands.
chronicle detect retrohunts --help # Retrohunt management commands.
chronicle detect rules --help # Rule management commands.
chronicle detect rulesets --help # Rule set deployment commands.
# chronicle detect alerts --help chronicle detect alerts bulk-update --help # Bulk update alerts matching a filter.
chronicle detect alerts get --help # Get an alert by ID.
chronicle detect alerts update --help # Update an alert.
# chronicle detect detections --help
chronicle detect detections get --help # Get a detection by ID.
chronicle detect detections list --help # List detections.
chronicle detect errors list --help
# chronicle detect retrohunts --help
chronicle detect retrohunts create --help # Create a new retrohunt.
chronicle detect retrohunts get --help # Get a retrohunt by ID.
# chronicle detect rules --help
chronicle detect rules create --help # Create a new rule.
chronicle detect rules delete --help # Delete a rule.
chronicle detect rules enable --help # Enable a rule.
chronicle detect rules get --help # Get a rule by ID.
chronicle detect rules list --help # List rules.
# chronicle detect rulesets --help
chronicle detect rulesets batch-update --help # Batch update rule set deployments.
# chronicle ingestion --help chronicle ingestion batch-get-events --help # Batch get events by IDs.
chronicle ingestion get-event --help # Get event details by ID.
chronicle ingestion import-events --help # Import events into Chronicle.
# chronicle iocs --help chronicle iocs batch-get --help # Get multiple IoCs by their values.
chronicle iocs get --help # Get a single IoC by its value.
chronicle iocs get-state --help # Get the state of an IoC by its value.
# chronicle lists --help
chronicle lists create --help # Create a new list.
chronicle lists get --help # Get a list by ID.
chronicle lists patch --help # Update an existing list.
# chronicle search --help
chronicle search find-asset-events --help # Find asset events within a time range.
chronicle search find-raw-logs --help # Find raw logs based on search criteria.
chronicle search find-udm-events --help # Find UDM events based on tokens or event IDs.
chronicle search get-search-query --help # Get a search query by ID.

New API resources

Help on CLI for chronicle detect detections get

❯ chronicle detect detections get --help
Usage: chronicle detect detections get [OPTIONS]
Get a detection by ID.
Options:
--region TEXT Region in which the target project is located. Can
also be set via CHRONICLE_REGION env var.
--project-instance TEXT Customer ID (uuid with dashes) for the Chronicle
instance. Can also be set via CHRONICLE_INSTANCE
env var.
--project-id TEXT GCP project id or number. Can also be set via
CHRONICLE_PROJECT_ID env var.
--credentials-file TEXT Path to service account credentials file. Can also
be set via CHRONICLE_CREDENTIALS_FILE env var.
--env-file TEXT Path to .env file containing configuration
variables.
--detection-id TEXT Identifier for the detection. [required]
--rule-id TEXT Identifier for the rule that created the detection.

CLI Usage example for chronicle detect detections get

❯ chronicle detect detections get \
--detection-id "de_92092e71-3baa-0ebf-f230-4aacc5952c63" \
--rule-id "ru_bf30236c-13af-4a85-a3af-5d58205e10f0"
{
"type": "RULE_DETECTION",
"detection": [
{
"ruleName": "ttp_powershell_decodebase64_ns139797",
...

Help for detect.v1alpha.get_detection

❯ python3 -m detect.v1alpha.get_detection --help
usage: get_detection.py [-h] [-c CREDENTIALS_FILE] -i PROJECT_INSTANCE -p PROJECT_ID
[-r {asia-northeast1,asia-south1,asia-southeast1,australia-southeast1,eu,europe,europe-west12,europe-west2,europe-west3,europe-west6,europe-west9,me-central1,me-central2,me-west1,northamerica-northeast2,southamerica-east1,us}]
--detection_id DETECTION_ID --rule_id RULE_ID
options:
-h, --help show this help message and exit
-c CREDENTIALS_FILE, --credentials_file CREDENTIALS_FILE
credentials file path (default: '/Users/dandye/.chronicle_credentials.json')
-i PROJECT_INSTANCE, --project_instance PROJECT_INSTANCE
Customer ID for Chronicle instance
-p PROJECT_ID, --project_id PROJECT_ID
Your BYOP, project id
-r {asia-northeast1,asia-south1,asia-southeast1,australia-southeast1,eu,europe,europe-west12,europe-west2,europe-west3,europe-west6,europe-west9,me-central1,me-central2,me-west1,northamerica-northeast2,southamerica-east1,us}, --region {asia-northeast1,asia-south1,asia-southeast1,australia-southeast1,eu,europe,europe-west12,europe-west2,europe-west3,europe-west6,europe-west9,me-central1,me-central2,me-west1,northamerica-northeast2,southamerica-east1,us}
the region where the customer is located (default: us)
--detection_id DETECTION_ID
Identifier for the detection
--rule_id RULE_ID Identifier for the rule that created the detection

Usage example

❯ PROJECT_INSTANCE=7e977ce4-f45d-43b2-aea0-52f8b66acd80
PROJECT_ID=dandye-0324-chronicle
python3 -m detect.v1alpha.get_detection \
--project_instance=$PROJECT_INSTANCE \
--project_id=$PROJECT_ID \
--detection_id "de_92092e71-3baa-0ebf-f230-4aacc5952c63" \
--rule_id "ru_bf30236c-13af-4a85-a3af-5d58205e10f0"
{
"type": "RULE_DETECTION",
"detection": [
{
"ruleName": "ttp_powershell_decodebase64_ns139797",

dandye added 30 commits March 6, 2025 21:04
I've made several improvements to streamline the SDK documentation:
Removed the duplicate "SDK CLI Wrapper" section and consolidated all CLI information in one place
Reorganized the README structure to be more logical:
Getting Started (prerequisites, installation, env setup)
SDK CLI Wrapper (main documentation)
Running Individual Scripts (alternative usage)
License
Improved command documentation:
Added command syntax templates for each API group
Made parameter descriptions more consistent
Added clear examples of required/optional parameters
Removed repetitive common parameters from examples
Enhanced environment variable documentation:
Added clear mapping between CLI options and env vars
Included example .env file structure
Explained precedence rules
The documentation is now more concise and easier to follow, with a clear focus on using environment variables for configuration.
copybara-serviceBot pushed a commit that referenced this pull request May 30, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 764942204
@copybara-servicecopybara-serviceBot mentioned this pull request May 30, 2025
copybara-serviceBot pushed a commit that referenced this pull request May 30, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 764942204
copybara-serviceBot pushed a commit that referenced this pull request May 30, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 764865423
copybara-serviceBot pushed a commit that referenced this pull request May 30, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 764865423
copybara-serviceBot pushed a commit that referenced this pull request Jun 25, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 775253266
@copybara-servicecopybara-serviceBot mentioned this pull request Jun 25, 2025
copybara-serviceBot pushed a commit that referenced this pull request Jun 25, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 775253266
copybara-serviceBot pushed a commit that referenced this pull request Sep 29, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 812832897
@copybara-servicecopybara-serviceBot mentioned this pull request Sep 29, 2025
copybara-serviceBot pushed a commit that referenced this pull request Oct 2, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 814252269
@copybara-servicecopybara-serviceBot mentioned this pull request Oct 2, 2025
copybara-serviceBot pushed a commit that referenced this pull request Oct 8, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 816750852
This was referenced Oct 8, 2025
copybara-serviceBot pushed a commit that referenced this pull request Oct 9, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 817206419
copybara-serviceBot pushed a commit that referenced this pull request Oct 16, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 820252746
@copybara-servicecopybara-serviceBot mentioned this pull request Oct 16, 2025
copybara-serviceBot pushed a commit that referenced this pull request Nov 7, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 829445533
@copybara-servicecopybara-serviceBot mentioned this pull request Nov 7, 2025
copybara-serviceBot pushed a commit that referenced this pull request Nov 7, 2025
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 829445533
copybara-serviceBot pushed a commit that referenced this pull request Apr 9, 2026
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 897284018
@copybara-servicecopybara-serviceBot mentioned this pull request Apr 9, 2026
copybara-serviceBot pushed a commit that referenced this pull request Apr 9, 2026
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 897284018
copybara-serviceBot pushed a commit that referenced this pull request Apr 9, 2026
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 897287602
@copybara-servicecopybara-serviceBot mentioned this pull request Apr 9, 2026
copybara-serviceBot pushed a commit that referenced this pull request Apr 10, 2026
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 897287602
copybara-serviceBot pushed a commit that referenced this pull request Jul 8, 2026
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 944151286
copybara-serviceBot pushed a commit that referenced this pull request Jul 22, 2026
FUTURE_COPYBARA_INTEGRATE_REVIEW=#188 from dandye:events_import_v1alpha 24f6b68
PiperOrigin-RevId: 944151286
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@dandye