GS2-Deploy/CDK Reference of GS2-Log

Entities

Namespace

Namespace

Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.

Therefore, it is necessary to create a namespace before starting to use each service.

TypeRequireDefaultLimitationDescription
namestring~ 32 charsNamespace name
descriptionstring~ 1024 charsdescription of Namespace
typestring“gs2”~ 128 charsLog Export Method
gcpCredentialJsonstring{type} == “bigquery”~ 5120 charsGCP Credentials
bigQueryDatasetNamestring{type} == “bigquery”~ 1024 charsBigQuery dataset name
logExpireDaysint{type} in [“gs2”, “bigquery”]~ 3650Log retention period (days)
awsRegionstring{type} == “firehose”~ 256 charsAWS Region
awsAccessKeyIdstring{type} == “firehose”~ 256 charsAWS access key ID
awsSecretAccessKeystring{type} == “firehose”~ 256 charsAWS Secret Access Key
firehoseStreamNamestring{type} == “firehose”~ 256 charsKinesis Firehose stream name

GetAttr

TypeDescription
ItemNamespaceNamespace created

Implementation Example

Type: GS2::Log::Namespace
Properties:
  Name: namespace1
  Description: null
  Type: gs2
  GcpCredentialJson: {"project_id": "gs2-dev"}
  BigQueryDatasetName: dataset_0001
  LogExpireDays: 3
  AwsRegion: awsRegion
  AwsAccessKeyId: awsAccessKeyId
  AwsSecretAccessKey: awsSecretAccessKey
  FirehoseStreamName: firehoseStreamName
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='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
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: "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() {
                {
                    type = "gs2";
                    gcpCredentialJson = "{\"project_id\": \"gs2-dev\"}";
                    bigQueryDatasetName = "dataset_0001";
                    logExpireDays = 3;
                    awsRegion = "awsRegion";
                    awsAccessKeyId = "awsAccessKeyId";
                    awsSecretAccessKey = "awsSecretAccessKey";
                    firehoseStreamName = "firehoseStreamName";
                }
            }
        );
    }
}

System.out.println(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: "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
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Log.Model.Namespace(
            this,
            "namespace-0001",
            new Gs2Cdk.Gs2Log.Model.Options.NamespaceOptions {
                type = "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

Insight

GS2-Insight is a tool for visualizing and analyzing access logs stored in GS2-Log. GS2-Insight itself is open source and available on github. https://github.com/gs2io/gs2-insight

Here, you can launch and use the publicly available open source code on-demand without hosting it yourself. GS2-Insight activated on demand can be used for up to 2 hours. If you wish to use it for more than 2 hours, please host it yourself.

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name

GetAttr

TypeDescription
ItemInsightGS2-Insight

Implementation Example

Type: GS2::Log::Insight
Properties:
  NamespaceName: namespace1
from gs2_cdk import Stack, core, log

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        log.Insight(
            stack=self,
            namespace_name="namespace-0001",
        )

print(SampleStack().yaml())  # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Log\Model\Insight(
            stack: $this,
            namespaceName: "namespace-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.Insight(
            this,
            "namespace-0001"
        );
    }
}

System.out.println(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.Insight(
            this,
            "namespace-0001"
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Log.Model.Insight(
            this,
            "namespace-0001"
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

AccessLog

TypeRequireDefaultLimitationDescription
timestamplongTimestamp
requestIdstring~ 1024 charsRequest ID
servicestring~ 1024 charsTypes of Microservices
methodstring~ 1024 charsMicroservice Methods
userIdstring~ 128 charsUser Id
requeststring~ 10485760 charsRequest Content
resultstring~ 10485760 charsResponse Content

AccessLogCount

TypeRequireDefaultLimitationDescription
servicestring~ 1024 charsTypes of Microservices
methodstring~ 1024 charsMicroservice Methods
userIdstring~ 128 charsUser Id
countlong~ 9223372036854775805Count

IssueStampSheetLog

TypeRequireDefaultLimitationDescription
timestamplongTimestamp
transactionIdstring~ 1024 charsTransaction ID
servicestring~ 1024 charsTypes of Microservices
methodstring~ 1024 charsMicroservice Methods
userIdstring~ 128 charsUser Id
actionstring~ 1024 charsAcquire Action
argsstring~ 5242880 charsArguments
tasksList<string>~ 10 itemsList of Stamp task

IssueStampSheetLogCount

TypeRequireDefaultLimitationDescription
servicestring~ 1024 charsTypes of Microservices
methodstring~ 1024 charsMicroservice Methods
userIdstring~ 128 charsUser Id
actionstring~ 1024 charsAcquire Action
countlong~ 9223372036854775805Count

ExecuteStampSheetLog

TypeRequireDefaultLimitationDescription
timestamplongTimestamp
transactionIdstring~ 1024 charsTransaction ID
servicestring~ 1024 charsTypes of Microservices
methodstring~ 1024 charsMicroservice Methods
userIdstring~ 128 charsUser Id
actionstring~ 1024 charsAcquire Action
argsstring~ 5242880 charsArguments

ExecuteStampSheetLogCount

TypeRequireDefaultLimitationDescription
servicestring~ 1024 charsTypes of Microservices
methodstring~ 1024 charsMicroservice Methods
userIdstring~ 128 charsUser Id
actionstring~ 1024 charsAcquire Action
countlong~ 9223372036854775805Count

ExecuteStampTaskLog

TypeRequireDefaultLimitationDescription
timestamplongTimestamp
taskIdstring~ 1024 charsTask ID
servicestring~ 1024 charsTypes of Microservices
methodstring~ 1024 charsMicroservice Methods
userIdstring~ 128 charsUser Id
actionstring~ 1024 charsAcquire Action
argsstring~ 5242880 charsArguments

ExecuteStampTaskLogCount

TypeRequireDefaultLimitationDescription
servicestring~ 1024 charsTypes of Microservices
methodstring~ 1024 charsMicroservice Methods
userIdstring~ 128 charsUser Id
actionstring~ 1024 charsAcquire Action
countlong~ 9223372036854775805Count