Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated log lib #1483

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 멀티 클라우드 환경 설정

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions scripts/usecases/elastic-stack/startFilebeat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
5 changes: 1 addition & 4 deletions src/core/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -41,7 +39,7 @@ type OptionalParameter struct {
}

// CB-Store
var CBLog *logrus.Logger

var CBStore icbs.Store

var SpiderRestUrl string
Expand Down Expand Up @@ -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")
Expand Down
14 changes: 6 additions & 8 deletions src/core/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -289,33 +289,31 @@ 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
}

fmt.Println("<" + keyValue.Key + "> " + keyValue.Value)

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
Expand Down
9 changes: 0 additions & 9 deletions src/core/mcir/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion src/core/mcis/remoteCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 0 additions & 9 deletions src/core/mcis/utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
5 changes: 3 additions & 2 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
Expand All @@ -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("")
Expand Down