# Template Generation
# Log collection template for ego framework
# Single machine creation
Note whether the subpath is configured. If the subpath is configured in the environment variable, such as /clickvisual/, you need to replace http://127.0.0.1:19001/api/v1/template/1
with http://127.0.0.1:19001/clickvisual/api/v1/template/1
curl --location --request POST 'http://127.0.0.1:19001/api/v1/template/1' \
--header 'Content-Type: application/json' \
--data-raw '{
"dsn": "clickhouse://username:password@host1:9000,host2:9000/database?dial_timeout=200ms&max_execution_time=60",
"clusterName": "clusterName",
"brokers": "kafka:9092"
}'
1
2
3
4
5
6
7
2
3
4
5
6
7
# No replica cluster creation
Note whether the subpath is configured. If the subpath is configured in the environment variable, such as /clickvisual/, you need to replace http://127.0.0.1:19001/api/v1/template/1
with http://127.0.0.1:19001/clickvisual/api/v1/template/1
k8sClusterName is k8s cluster name
instanceClusterName is ClickHouse cluster
curl --location --request POST 'http://127.0.0.1:19001/api/v1/template/1' \
--header 'Content-Type: application/json' \
--data-raw '{
"dsn": "clickhouse://username:password@host1:9000,host2:9000/database?dial_timeout=200ms&max_execution_time=60",
"k8sClusterName": "clusterName",
"brokers": "kafka:9092",
"instanceClusterName": "shard2-repl1"
}'
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# topic
%s is clusterName for parameter call
var kafkaTopicORM = map[string]string{
"app_stdout": "app-stdout-logs-%s",
"ego_stdout": "ego-stdout-logs-%s",
"ingress_stdout": "ingress-stdout-logs-%s",
"ingress_stderr": "ingress-stderr-logs-%s",
}
1
2
3
4
5
6
2
3
4
5
6
# Results
- Created a clickvisual_default instance
- Created a clickvisual_default database
- Created some log libraries: app-stdout, ego-stdout, ingress-stdout, ingress-stderr
- Created some Analysis fields in log libraries