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

fix oem issue #134

Merged
merged 1 commit into from
Aug 14, 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
12 changes: 6 additions & 6 deletions infrastructure/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/taosdata/taoskeeper/version"
)

var Name = "taoskeeper"
var Name = fmt.Sprintf("%skeeper", version.CUS_PROMPT)

type Config struct {
Cors web.CorsConfig `toml:"cors"`
Expand Down Expand Up @@ -60,24 +60,24 @@ func InitConfig() *Config {
cp = pflag.StringP("config", "c", "", fmt.Sprintf("config path default /etc/%s/%s.toml", version.CUS_PROMPT, Name))
}

transfer := pflag.StringP("transfer", "", "", "run taoskeeper in command mode, only support old_taosd_metric. transfer old metrics data to new tables and exit")
transfer := pflag.StringP("transfer", "", "", "run "+Name+" in command mode, only support old_taosd_metric. transfer old metrics data to new tables and exit")
fromTime := pflag.StringP("fromTime", "", "2020-01-01T00:00:00+08:00", "parameter of transfer, example: 2020-01-01T00:00:00+08:00")
drop := pflag.StringP("drop", "", "", "run taoskeeper in command mode, only support old_taosd_metric_stables. ")
drop := pflag.StringP("drop", "", "", "run "+Name+" in command mode, only support old_taosd_metric_stables. ")

v := pflag.BoolP("version", "V", false, "Print the version and exit")
help := pflag.BoolP("help", "h", false, "Print this help message and exit")

pflag.Parse()

if *help {
fmt.Fprintf(os.Stderr, "Usage of taosKeeper v%s:\n", version.Version)
fmt.Fprintf(os.Stderr, "Usage of %s v%s:\n", Name, version.Version)
pflag.CommandLine.SortFlags = false
pflag.PrintDefaults()
os.Exit(0)
}

if *v {
fmt.Printf("taoskeeper version: %s\n", version.Version)
fmt.Printf("%s version: %s\n", Name, version.Version)
fmt.Printf("git: %s\n", version.Gitinfo)
fmt.Printf("build: %s\n", version.BuildInfo)
os.Exit(0)
Expand All @@ -87,7 +87,7 @@ func InitConfig() *Config {
viper.SetConfigFile(*cp)
}

viper.SetEnvPrefix("taoskeeper")
viper.SetEnvPrefix(Name)
err := viper.BindPFlags(pflag.CommandLine)
if err != nil {
panic(err)
Expand Down
5 changes: 4 additions & 1 deletion infrastructure/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ import (
"path"
"sync"
"time"

rotatelogs "github.com/huskar-t/file-rotatelogs/v2"
"github.com/sirupsen/logrus"
"github.com/taosdata/taoskeeper/infrastructure/config"

"github.com/taosdata/taoskeeper/version"
)

var logger = logrus.New()
Expand Down Expand Up @@ -114,7 +117,7 @@ func ConfigLog() {
panic(err)
}
writer, err := rotatelogs.New(
path.Join(config.Conf.Log.Path, fmt.Sprintf("taoskeeper_%%Y_%%m_%%d_%%H_%%M.log")),
path.Join(config.Conf.Log.Path, fmt.Sprintf("%skeeper_%%Y_%%m_%%d_%%H_%%M.log", version.CUS_PROMPT)),
rotatelogs.WithRotationCount(config.Conf.Log.RotationCount),
rotatelogs.WithRotationTime(config.Conf.Log.RotationTime),
rotatelogs.WithRotationSize(int64(config.Conf.Log.RotationSize)),
Expand Down
Loading