GS2-Log Deploy/CDK Reference

The template format used when creating stacks with GS2-Deploy, and implementation examples of template output in various languages using CDK

Entities

Resources managed by the Deploy operation

Namespace

Namespace

A Namespace allows multiple independent instances of the same service within a single project by separating data spaces and usage contexts. Each GS2 service is managed on a per-namespace basis. Even when using the same service, if the Namespace differs, the data is treated as a completely independent data space.

Therefore, you must create a Namespace before you can start using each service.

Request

Resource creation and update requests

TypeConditionRequiredDefaultValue LimitsDescription
namestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
descriptionstring~ 1024 charsDescription
typeString Enum
enum {
  “gs2”,
  “bigquery”,
  “firehose”
}
“gs2”Log Export Method
Determines the destination for exported log data. “gs2” stores logs within GS2’s managed storage with built-in search and analysis capabilities. “bigquery” exports logs to Google BigQuery for advanced analytics. “firehose” streams logs to Amazon Kinesis Data Firehose for delivery to S3, Redshift, or other AWS destinations.
DefinitionDescription
“gs2”Management by GS2
“bigquery”Export to BigQuery
“firehose”Export to Kinesis Firehose
gcpCredentialJsonstring{type} == “bigquery”
✓*
~ 5120 charsGCP Credentials
GCP credential JSON for authenticating when exporting logs to BigQuery. The service account must have BigQuery Data Editor permissions on the target dataset.
* Required if type is “bigquery”
bigQueryDatasetNamestring{type} == “bigquery”
✓*
~ 1024 charsBigQuery Dataset Name
The name of the BigQuery dataset where log data will be exported. The dataset must already exist in the GCP project associated with the provided credentials.
* Required if type is “bigquery”
logExpireDaysint{type} in [“gs2”, “bigquery”]
✓*
0 ~ 3650Log Retention Period (days)
The number of days to retain log data. Logs older than this period are automatically deleted. Applicable when the export method is “gs2” or “bigquery”. Maximum 3650 days (approximately 10 years).
* Required if type is “gs2”,“bigquery”
awsRegionstring{type} == “firehose”
✓*
~ 256 charsAWS Region
The AWS region where the Kinesis Data Firehose delivery stream is located (e.g., us-east-1, ap-northeast-1).
* Required if type is “firehose”
awsAccessKeyIdstring{type} == “firehose”
✓*
~ 256 charsAWS Access Key ID
The AWS access key ID for authenticating with Kinesis Data Firehose. The IAM user must have permissions to put records to the specified Firehose delivery stream.
* Required if type is “firehose”
awsSecretAccessKeystring{type} == “firehose”
✓*
~ 256 charsAWS Secret Access Key
The AWS secret access key paired with the access key ID for Kinesis Data Firehose authentication.
* Required if type is “firehose”
firehoseStreamNamestring{type} == “firehose”
✓*
~ 256 charsKinesis Firehose Stream Name
The name of the Kinesis Data Firehose delivery stream to which log data is sent.
* Required if type is “firehose”
firehoseCompressDataString Enum
enum {
  “none”,
  “gzip”
}
{type} == “firehose”“none”Compress Data for Kinesis Firehose
Whether to compress log data before sending to Kinesis Data Firehose. Gzip compression reduces data transfer volume and storage costs.
DefinitionDescription
“none”Do not compress
“gzip”Gzip
* Required if type is “firehose”

GetAttr

Resource creation results that can be retrieved using the !GetAttr tag

TypeDescription
ItemNamespaceNamespace created

Implementation Example

Type: GS2::Log::Namespace
Properties:
  Name: namespace-0001
  Description: null
  Type: gs2
  GcpCredentialJson: {"project_id": "gs2-dev"}
  BigQueryDatasetName: dataset_0001
  LogExpireDays: 3
  AwsRegion: awsRegion
  AwsAccessKeyId: awsAccessKeyId
  AwsSecretAccessKey: awsSecretAccessKey
  FirehoseStreamName: firehoseStreamName
  FirehoseCompressData: null
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/log"
    "github.com/openlyinc/pointy"
)


SampleStack := core.NewStack()
log.NewNamespace(
    &SampleStack,
    "namespace-0001",
    log.NamespaceOptions{
        Type: log.NamespaceTypeGs2,
        GcpCredentialJson: pointy.String("{\"project_id\": \"gs2-dev\"}"),
        BigQueryDatasetName: pointy.String("dataset_0001"),
        LogExpireDays: pointy.Int32(3),
        AwsRegion: pointy.String("awsRegion"),
        AwsAccessKeyId: pointy.String("awsAccessKeyId"),
        AwsSecretAccessKey: pointy.String("awsSecretAccessKey"),
        FirehoseStreamName: pointy.String("firehoseStreamName"),
    },
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Log\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Log\Model\Options\NamespaceOptions(
                type: \Gs2Cdk\Log\Model\Enums\NamespaceType::GS2,
                gcpCredentialJson: "{\"project_id\": \"gs2-dev\"}",
                bigQueryDatasetName: "dataset_0001",
                logExpireDays: 3,
                awsRegion: "awsRegion",
                awsAccessKeyId: "awsAccessKeyId",
                awsSecretAccessKey: "awsSecretAccessKey",
                firehoseStreamName: "firehoseStreamName"
            )
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.log.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.log.model.options.NamespaceOptions()
                        .withType(io.gs2.cdk.log.model.enums.NamespaceType.GS2)
                        .withGcpCredentialJson("{\"project_id\": \"gs2-dev\"}")
                        .withBigQueryDatasetName("dataset_0001")
                        .withLogExpireDays(3)
                        .withAwsRegion("awsRegion")
                        .withAwsAccessKeyId("awsAccessKeyId")
                        .withAwsSecretAccessKey("awsSecretAccessKey")
                        .withFirehoseStreamName("firehoseStreamName")
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Log.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Log.Model.Options.NamespaceOptions
            {
                type = Gs2Cdk.Gs2Log.Model.Enums.NamespaceType.Gs2,
                gcpCredentialJson = "{\"project_id\": \"gs2-dev\"}",
                bigQueryDatasetName = "dataset_0001",
                logExpireDays = 3,
                awsRegion = "awsRegion",
                awsAccessKeyId = "awsAccessKeyId",
                awsSecretAccessKey = "awsSecretAccessKey",
                firehoseStreamName = "firehoseStreamName"
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import core from "@/gs2cdk/core";
import log from "@/gs2cdk/log";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new log.model.Namespace(
            this,
            "namespace-0001",
            {
                type: log.model.NamespaceType.GS2,
                gcpCredentialJson: "{\"project_id\": \"gs2-dev\"}",
                bigQueryDatasetName: "dataset_0001",
                logExpireDays: 3,
                awsRegion: "awsRegion",
                awsAccessKeyId: "awsAccessKeyId",
                awsSecretAccessKey: "awsSecretAccessKey",
                firehoseStreamName: "firehoseStreamName"
            }
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
from gs2_cdk import Stack, core, log

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        log.Namespace(
            stack=self,
            name='namespace-0001',
            options=log.NamespaceOptions(
                type=log.NamespaceType.GS2,
                gcp_credential_json='{"project_id": "gs2-dev"}',
                big_query_dataset_name='dataset_0001',
                log_expire_days=3,
                aws_region='awsRegion',
                aws_access_key_id='awsAccessKeyId',
                aws_secret_access_key='awsSecretAccessKey',
                firehose_stream_name='firehoseStreamName',
            ),
        )

print(SampleStack().yaml())  # Generate Template

Dashboard

Dashboard

A customizable dashboard for visualizing log data and metrics. Each dashboard stores its layout and widget configuration as a JSON payload, allowing users to create tailored views of their log analytics.

Request

Resource creation and update requests

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
displayNamestring
~ 256 charsDisplay Name
A human-readable name for this dashboard, shown in the dashboard list and header.
descriptionstring~ 1024 charsDescription

GetAttr

Resource creation results that can be retrieved using the !GetAttr tag

TypeDescription
ItemDashboardCreated Dashboard

Implementation Example

Type: GS2::Log::Dashboard
Properties:
  NamespaceName: namespace-0001
  DisplayName: Sample Dashboard 0001
  Description: null
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/log"
)


SampleStack := core.NewStack()
log.NewDashboard(
    &SampleStack,
    "namespace-0001",
    "Sample Dashboard 0001",
    log.DashboardOptions{},
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Log\Model\Dashboard(
            stack: $this,
            namespaceName: "namespace-0001",
            displayName: "Sample Dashboard 0001"
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.log.model.Dashboard(
                this,
                "namespace-0001",
                "Sample Dashboard 0001"
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Log.Model.Dashboard(
            stack: this,
            namespaceName: "namespace-0001",
            displayName: "Sample Dashboard 0001"
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import core from "@/gs2cdk/core";
import log from "@/gs2cdk/log";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new log.model.Dashboard(
            this,
            "namespace-0001",
            "Sample Dashboard 0001"
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
from gs2_cdk import Stack, core, log

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        log.Dashboard(
            stack=self,
            namespace_name='namespace-0001',
            display_name='Sample Dashboard 0001',
        )

print(SampleStack().yaml())  # Generate Template

FacetModel

Facet Model

Defines a facet field available for filtering and aggregating log data. Facets allow users to narrow down log search results by specific dimensions such as service name, method, status, or custom fields.

Request

Resource creation and update requests

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
fieldstring
~ 128 charsFacet Field Name
The name of the log field that this facet operates on (e.g., “service”, “method”, “status”).
typeString Enum
enum {
  “string”,
  “double”,
  “measure”
}
Facet Data Type
The data type of the facet field. “string” for categorical values with value counts, “double” for numeric values with range filtering, “measure” for measurement values with statistical analysis.
DefinitionDescription
“string”String
“double”Double
“measure”Measure
displayNamestring
~ 128 charsDisplay Name
A human-readable name for this facet, shown in the log search UI.
orderint00 ~ 100000Display Order
The sort order for displaying this facet in the UI. Lower values appear first.

GetAttr

Resource creation results that can be retrieved using the !GetAttr tag

TypeDescription
ItemFacetModelCreated Facet Model

Implementation Example

Type: GS2::Log::FacetModel
Properties:
  NamespaceName: namespace-0001
  Field: facet-model-0001
  Type: string
  DisplayName: Sample Facet Model 0001
  Order: null
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/log"
)


SampleStack := core.NewStack()
log.NewFacetModel(
    &SampleStack,
    "namespace-0001",
    "facet-model-0001",
    log.FacetModelTypeString,
    "Sample Facet Model 0001",
    log.FacetModelOptions{},
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Log\Model\FacetModel(
            stack: $this,
            namespaceName: "namespace-0001",
            field: "facet-model-0001",
            type: \Gs2Cdk\Log\Model\Enums\FacetModelType::STRING,
            displayName: "Sample Facet Model 0001"
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.log.model.FacetModel(
                this,
                "namespace-0001",
                "facet-model-0001",
                io.gs2.cdk.log.model.enums.FacetModelType.STRING,
                "Sample Facet Model 0001"
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Log.Model.FacetModel(
            stack: this,
            namespaceName: "namespace-0001",
            field: "facet-model-0001",
            type: Gs2Cdk.Gs2Log.Model.Enums.FacetModelType.String,
            displayName: "Sample Facet Model 0001"
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import core from "@/gs2cdk/core";
import log from "@/gs2cdk/log";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new log.model.FacetModel(
            this,
            "namespace-0001",
            "facet-model-0001",
            log.model.FacetModelType.STRING,
            "Sample Facet Model 0001"
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
from gs2_cdk import Stack, core, log

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        log.FacetModel(
            stack=self,
            namespace_name='namespace-0001',
            field='facet-model-0001',
            type=log.FacetModelType.STRING,
            display_name='Sample Facet Model 0001',
        )

print(SampleStack().yaml())  # Generate Template