diff --git a/Dockerfile b/Dockerfile index 5e0dbf60..37b45af5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,6 @@ COPY --from=builder /go/src/github.com/cloud-barista/cb-tumblebug/src/cb-tumbleb # Setting various environment variables required by the application ENV CBTUMBLEBUG_ROOT=/app \ CBSTORE_ROOT=/app \ - CBLOG_ROOT=/app \ SPIDER_CALL_METHOD=REST \ DRAGONFLY_CALL_METHOD=REST \ SPIDER_REST_URL=http://cb-spider:1024/spider \ diff --git a/README.md b/README.md index c319b1cc..6406dbd8 100644 --- a/README.md +++ b/README.md @@ -225,7 +225,7 @@ Check out [CONTRIBUTING](https://github.com/cloud-barista/cb-tumblebug/blob/main - `cb-tumblebug/conf` 의 `store_conf.yaml` 내용 확인 및 설정 (cb-store 환경변수, 필요에 따라 변경) - storetype 지정 (NUTSDB 또는 ETCD 지정) - NUTSDB(local DB) 설정시 DB 데이터가 포함된 주소 지정이 필요 (기본은 `cb-tumblebug/meta_db/dat` 에 파일로 추가됨) - - `cb-tumblebug/conf` 의 `log_conf.yaml` 내용 확인 및 설정 (cb-log 환경변수, 필요에 따라 변경) + - CB-Tumblebug 실행 ```bash @@ -263,11 +263,11 @@ Check out [CONTRIBUTING](https://github.com/cloud-barista/cb-tumblebug/blob/main Access to API dashboard (username: default / password: default) - http://xxx.xxx.xxx.xxx:1323/tumblebug/swagger/ + http://xxx.xxx.xxx.xxx:1323/tumblebug/api ⇨ http server started on [::]:1323 ``` - + - `cb-tumblebug/conf/setup.env` 기본 설정 활용시, 시스템 로그는 `cb-tumblebug/log/tumblebug.log`에 저장됨 (log는 zerolog를 통해 기록) ### (4) CB-Tumblebug 멀티 클라우드 환경 설정 diff --git a/go.mod b/go.mod index 232a3870..78b7c627 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( github.com/mattn/go-sqlite3 v1.14.19 github.com/rs/xid v1.5.0 github.com/rs/zerolog v1.32.0 - github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.8.4 @@ -68,6 +67,7 @@ require ( github.com/rivo/uniseg v0.2.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/snowzach/rotatefilehook v0.0.0-20220211133110-53752135082d // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect diff --git a/scripts/usecases/elastic-stack/startFilebeat.sh b/scripts/usecases/elastic-stack/startFilebeat.sh index b19140ce..70ca5079 100644 --- a/scripts/usecases/elastic-stack/startFilebeat.sh +++ b/scripts/usecases/elastic-stack/startFilebeat.sh @@ -87,7 +87,7 @@ echo "Configuring Filebeat..." sudo sed -i -e 's/- type: filestream/- type: log/' \ -e 's/ enabled: false/ enabled: true/' \ -e 's/ id: my-filestream-id/ #id: my-filestream-id/' \ - -e 's/ - \/var\/log\/\*.log/ - \/var\/log\/cblog\/\*.log/' /etc/filebeat/filebeat.yml + -e 's/ - \/var\/log\/\*.log/ - \/var\/log\/tumblebug\/\*.log/' /etc/filebeat/filebeat.yml # Disable output to Elasticsearch sudo sed -i '/output.elasticsearch:/,/hosts: \["localhost:9200"\]/s/^/#/' /etc/filebeat/filebeat.yml @@ -143,4 +143,4 @@ FILEBEAT_PID_LIST=($(pgrep -f filebeat)) echo "FILEBEAT_PID List: ${FILEBEAT_PID_LIST[@]}" echo "Location of the log files collected by Filebeat:" -echo "/var/log/cblog/*.log" +echo "/var/log/tumblebug/*.log" diff --git a/src/core/common/common.go b/src/core/common/common.go index 760c87a8..31ce89a2 100644 --- a/src/core/common/common.go +++ b/src/core/common/common.go @@ -19,9 +19,7 @@ import ( "time" cbstore "github.com/cloud-barista/cb-store" - "github.com/cloud-barista/cb-store/config" icbs "github.com/cloud-barista/cb-store/interfaces" - "github.com/sirupsen/logrus" "xorm.io/xorm" ) @@ -41,7 +39,7 @@ type OptionalParameter struct { } // CB-Store -var CBLog *logrus.Logger + var CBStore icbs.Store var SpiderRestUrl string @@ -87,7 +85,6 @@ const ( var StartTime string func init() { - CBLog = config.Cblogger CBStore = cbstore.GetStore() StartTime = time.Now().Format("2006.01.02 15:04:05 Mon") diff --git a/src/core/common/config.go b/src/core/common/config.go index 47fd606c..887a0851 100644 --- a/src/core/common/config.go +++ b/src/core/common/config.go @@ -207,7 +207,7 @@ func UpdateGlobalVariable(id string) error { configInfo, err := GetConfig(id) if err != nil { - //log.Error().Err(err).Msg("") + log.Info().Msg(err.Error()) return err } @@ -289,25 +289,23 @@ func GetConfig(id string) (ConfigInfo, error) { res := ConfigInfo{} check, err := CheckConfig(id) + errString := id + " config is not found from Key-value store. Envirionment variable will be used." if !check { - errString := "The config " + id + " does not exist." err := fmt.Errorf(errString) return res, err } if err != nil { - temp := ConfigInfo{} - log.Error().Err(err).Msg("") - return temp, err + err := fmt.Errorf(errString) + return res, err } - fmt.Println("[Get config] " + id) key := "/config/" + id keyValue, err := CBStore.Get(key) if err != nil { - //log.Error().Err(err).Msg("") + err := fmt.Errorf(errString) return res, err } @@ -315,7 +313,7 @@ func GetConfig(id string) (ConfigInfo, error) { err = json.Unmarshal([]byte(keyValue.Value), &res) if err != nil { - log.Error().Err(err).Msg("") + err := fmt.Errorf(errString) return res, err } return res, nil diff --git a/src/core/mcir/common.go b/src/core/mcir/common.go index 4b1b1bf7..f6cdedc0 100644 --- a/src/core/mcir/common.go +++ b/src/core/mcir/common.go @@ -44,19 +44,10 @@ import ( "github.com/rs/zerolog/log" ) -// CB-Store -//var cblog *logrus.Logger -//var store icbs.Store - -//var SPIDER_REST_URL string - // use a single instance of Validate, it caches struct info var validate *validator.Validate func init() { - //cblog = config.Cblogger - //store = cbstore.GetStore() - //SPIDER_REST_URL = os.Getenv("SPIDER_REST_URL") validate = validator.New() diff --git a/src/core/mcis/remoteCommand.go b/src/core/mcis/remoteCommand.go index b3b8ead6..67080eee 100644 --- a/src/core/mcis/remoteCommand.go +++ b/src/core/mcis/remoteCommand.go @@ -446,7 +446,7 @@ func UpdateVmSshKey(nsId string, mcisId string, vmId string, verifiedUserName st // Internal functions for SSH func init() { - //cblog = config.Cblogger + } type sshInfo struct { diff --git a/src/core/mcis/utility.go b/src/core/mcis/utility.go index acf276ee..ed7a5858 100644 --- a/src/core/mcis/utility.go +++ b/src/core/mcis/utility.go @@ -36,19 +36,10 @@ import ( validator "github.com/go-playground/validator/v10" ) -// CB-Store -//var cblog *logrus.Logger -//var store icbs.Store - -//var SPIDER_REST_URL string - // use a single instance of Validate, it caches struct info var validate *validator.Validate func init() { - //cblog = config.Cblogger - //store = cbstore.GetStore() - //SPIDER_REST_URL = os.Getenv("SPIDER_REST_URL") validate = validator.New() diff --git a/src/main.go b/src/main.go index 0cf43f27..ede8321c 100644 --- a/src/main.go +++ b/src/main.go @@ -61,7 +61,7 @@ func setConfig() { log.Error().Err(err).Msg("") panic(fmt.Errorf("fatal error reading cloud_conf: %w", err)) } - fmt.Println(viper.ConfigFileUsed()) + log.Info().Msg(viper.ConfigFileUsed()) err = viper.Unmarshal(&common.RuntimeConf) if err != nil { log.Error().Err(err).Msg("") @@ -79,7 +79,8 @@ func setConfig() { if err != nil { panic(fmt.Errorf("fatal error reading cloudinfo config file: %w", err)) } - fmt.Println(cloudInfoViper.ConfigFileUsed()) + + log.Info().Msg(cloudInfoViper.ConfigFileUsed()) err = cloudInfoViper.Unmarshal(&common.RuntimeCloudInfo) if err != nil { log.Error().Err(err).Msg("")