> For the complete documentation index, see [llms.txt](/llms.txt)

# 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

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓|  |  ~ 128 chars | Namespace name<br>Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
| description | string |  | |  |  ~ 1024 chars | Description |
| type | string (enum)<br>enum {<br>"gs2",<br>"bigquery",<br>"firehose"<br>}<br> |  | | "gs2" |  | Log Export Method<br>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.gs2: Management by GS2 / bigquery: Export to BigQuery / firehose: Export to Kinesis Firehose /  |
| gcpCredentialJson | string | {type} == "bigquery" | ✓*|  |  ~ 5120 chars | GCP Credentials<br>GCP credential JSON for authenticating when exporting logs to BigQuery. The service account must have BigQuery Data Editor permissions on the target dataset.<br>* Required if type is "bigquery" |
| bigQueryDatasetName | string | {type} == "bigquery" | ✓*|  |  ~ 1024 chars | BigQuery Dataset Name<br>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.<br>* Required if type is "bigquery" |
| logExpireDays | int | {type} in ["gs2", "bigquery"] | ✓*|  | 0 ~ 3650 | Log Retention Period (days)<br>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).<br>* Required if type is "gs2","bigquery" |
| awsRegion | string | {type} == "firehose" | ✓*|  |  ~ 256 chars | AWS Region<br>The AWS region where the Kinesis Data Firehose delivery stream is located (e.g., us-east-1, ap-northeast-1).<br>* Required if type is "firehose" |
| awsAccessKeyId | string | {type} == "firehose" | ✓*|  |  ~ 256 chars | AWS Access Key ID<br>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.<br>* Required if type is "firehose" |
| awsSecretAccessKey | string | {type} == "firehose" | ✓*|  |  ~ 256 chars | AWS Secret Access Key<br>The AWS secret access key paired with the access key ID for Kinesis Data Firehose authentication.<br>* Required if type is "firehose" |
| firehoseStreamName | string | {type} == "firehose" | ✓*|  |  ~ 256 chars | Kinesis Firehose Stream Name<br>The name of the Kinesis Data Firehose delivery stream to which log data is sent.<br>* Required if type is "firehose" |
| firehoseCompressData | string (enum)<br>enum {<br>"none",<br>"gzip"<br>}<br> | {type} == "firehose" | | "none" |  | Compress Data for Kinesis Firehose<br>Whether to compress log data before sending to Kinesis Data Firehose. Gzip compression reduces data transfer volume and storage costs.none: Do not compress / gzip: Gzip / <br>* Required if type is "firehose" |

#### GetAttr

Resource creation results that can be retrieved using the [!GetAttr](/articles/tech/deploy/#getattr) tag

| | Type | Description |
| --- | --- | --- |
| Item | [Namespace](../sdk#namespace) | Namespace created

#### Implementation Example




**GS2-Deploy(YAML)**
```yaml

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

```

**Go**
```go

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

```

**PHP**
```php

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

```

**Java**
```java

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

```

**C#**
```csharp

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

```

**TypeScript**
```typescript

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

```

**Python**
```python

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

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128 chars | Namespace name<br>Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
| displayName | string |  | ✓|  |  ~ 256 chars | Display Name<br>A human-readable name for this dashboard, shown in the dashboard list and header. |
| description | string |  | |  |  ~ 1024 chars | Description |

#### GetAttr

Resource creation results that can be retrieved using the [!GetAttr](/articles/tech/deploy/#getattr) tag

| | Type | Description |
| --- | --- | --- |
| Item | [Dashboard](../sdk#dashboard) | Created Dashboard

#### Implementation Example




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Log::Dashboard
Properties:
  NamespaceName: namespace-0001
  DisplayName: Sample Dashboard 0001
  Description: null

```

**Go**
```go

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

```

**PHP**
```php

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

```

**Java**
```java

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

```

**C#**
```csharp

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

```

**TypeScript**
```typescript

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

```

**Python**
```python

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

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128 chars | Namespace name<br>Unique Namespace name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
| field | string |  | ✓|  |  ~ 128 chars | Facet Field Name<br>The name of the log field that this facet operates on (e.g., "service", "method", "status"). |
| type | string (enum)<br>enum {<br>"string",<br>"double",<br>"measure"<br>}<br> |  | ✓|  |  | Facet Data Type<br>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.string: String / double: Double / measure: Measure /  |
| displayName | string |  | ✓|  |  ~ 128 chars | Display Name<br>A human-readable name for this facet, shown in the log search UI. |
| order | int |  | | 0 | 0 ~ 100000 | Display Order<br>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](/articles/tech/deploy/#getattr) tag

| | Type | Description |
| --- | --- | --- |
| Item | [FacetModel](../sdk#facetmodel) | Created Facet Model

#### Implementation Example




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Log::FacetModel
Properties:
  NamespaceName: namespace-0001
  Field: facet-model-0001
  Type: string
  DisplayName: Sample Facet Model 0001
  Order: null

```

**Go**
```go

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

```

**PHP**
```php

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

```

**Java**
```java

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

```

**C#**
```csharp

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

```

**TypeScript**
```typescript

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

```

**Python**
```python

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

```


---



