GS2-Log GS2-Deploy/CDK リファレンス
エンティティ
Namespace
ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
name | string | ✓ | | ~ 32文字 | ネームスペース名 |
description | string | | | ~ 1024文字 | 説明文 |
type | string | ✓ | “gs2” | ~ 128文字 | ログの書き出し方法 |
gcpCredentialJson | string | {type} == “bigquery” | | ~ 5120文字 | GCPのクレデンシャル |
bigQueryDatasetName | string | {type} == “bigquery” | | ~ 1024文字 | BigQueryのデータセット名 |
logExpireDays | int | {type} in [“gs2”, “bigquery”] | | ~ 3650 | ログの保存期間(日) |
awsRegion | string | {type} == “firehose” | | ~ 256文字 | AWSのリージョン |
awsAccessKeyId | string | {type} == “firehose” | | ~ 256文字 | AWSのアクセスキーID |
awsSecretAccessKey | string | {type} == “firehose” | | ~ 256文字 | AWSのシークレットアクセスキー |
firehoseStreamName | string | {type} == “firehose” | | ~ 256文字 | Kinesis Firehose のストリーム名 |
GetAttr
実装例
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 は GS2-Log に蓄積されたアクセスログを可視化・分析するツールです。
GS2-Insight 自体はオープンソースで github にて公開されています。
https://github.com/gs2io/gs2-insight
ここでは、公開されているオープンソースのコードをご自身でホスティングすることなく、オンデマンドで起動してご利用いただけます。
オンデマンド起動された GS2-Insight は最大2時間利用することができます。
2時間を超えて利用したい場合は、ご自身でホスティングしてご利用ください。
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
GetAttr
実装例
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
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
timestamp | long | ✓ | | | 日時 |
requestId | string | ✓ | | ~ 1024文字 | リクエストID |
service | string | ✓ | | ~ 1024文字 | マイクロサービスの種類 |
method | string | ✓ | | ~ 1024文字 | マイクロサービスのメソッド |
userId | string | | | ~ 128文字 | ユーザーID |
request | string | ✓ | | ~ 10485760文字 | リクエストパラメータ |
result | string | ✓ | | ~ 10485760文字 | 応答内容 |
AccessLogCount
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
service | string | | | ~ 1024文字 | マイクロサービスの種類 |
method | string | | | ~ 1024文字 | マイクロサービスのメソッド |
userId | string | | | ~ 128文字 | ユーザーID |
count | long | ✓ | | ~ 9223372036854775805 | 回数 |
IssueStampSheetLog
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
timestamp | long | ✓ | | | 日時 |
transactionId | string | ✓ | | ~ 1024文字 | トランザクションID |
service | string | ✓ | | ~ 1024文字 | マイクロサービスの種類 |
method | string | ✓ | | ~ 1024文字 | マイクロサービスのメソッド |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
action | string | ✓ | | ~ 1024文字 | 報酬アクション |
args | string | ✓ | | ~ 5242880文字 | 引数 |
tasks | List<string> | | | | スタンプタスクリスト |
IssueStampSheetLogCount
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
service | string | | | ~ 1024文字 | マイクロサービスの種類 |
method | string | | | ~ 1024文字 | マイクロサービスのメソッド |
userId | string | | | ~ 128文字 | ユーザーID |
action | string | | | ~ 1024文字 | 報酬アクション |
count | long | ✓ | | ~ 9223372036854775805 | 回数 |
ExecuteStampSheetLog
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
timestamp | long | ✓ | | | 日時 |
transactionId | string | ✓ | | ~ 1024文字 | トランザクションID |
service | string | ✓ | | ~ 1024文字 | マイクロサービスの種類 |
method | string | ✓ | | ~ 1024文字 | マイクロサービスのメソッド |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
action | string | ✓ | | ~ 1024文字 | 報酬アクション |
args | string | ✓ | | ~ 5242880文字 | 引数 |
ExecuteStampSheetLogCount
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
service | string | | | ~ 1024文字 | マイクロサービスの種類 |
method | string | | | ~ 1024文字 | マイクロサービスのメソッド |
userId | string | | | ~ 128文字 | ユーザーID |
action | string | | | ~ 1024文字 | 報酬アクション |
count | long | ✓ | | ~ 9223372036854775805 | 回数 |
ExecuteStampTaskLog
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
timestamp | long | ✓ | | | 日時 |
taskId | string | ✓ | | ~ 1024文字 | タスクID |
service | string | ✓ | | ~ 1024文字 | マイクロサービスの種類 |
method | string | ✓ | | ~ 1024文字 | マイクロサービスのメソッド |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
action | string | ✓ | | ~ 1024文字 | 報酬アクション |
args | string | ✓ | | ~ 5242880文字 | 引数 |
ExecuteStampTaskLogCount
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
service | string | | | ~ 1024文字 | マイクロサービスの種類 |
method | string | | | ~ 1024文字 | マイクロサービスのメソッド |
userId | string | | | ~ 128文字 | ユーザーID |
action | string | | | ~ 1024文字 | 報酬アクション |
count | long | ✓ | | ~ 9223372036854775805 | 回数 |