提交 64cc76ca 编写于 作者: G Ganlin Zhao

add enable button

上级 00c3be67
......@@ -148,10 +148,13 @@ extern int32_t tsHttpKeepAlive;
extern int8_t tsEnableMonitorModule;
extern int8_t tsMonitorReplica;
extern char tsMonitorDbName[];
extern char tsAuditDbName[];
extern char tsInternalPass[];
extern int32_t tsMonitorInterval;
// audit
extern int8_t tsEnableAudit;
extern char tsAuditDbName[];
// stream
extern int8_t tsEnableStream;
......
......@@ -197,10 +197,13 @@ int32_t tsHttpKeepAlive = 30000;
int8_t tsEnableMonitorModule = 1;
int8_t tsMonitorReplica = 1;
char tsMonitorDbName[TSDB_DB_NAME_LEN] = "log";
char tsAuditDbName[TSDB_DB_NAME_LEN] = "audit";
char tsInternalPass[] = "secretkey";
int32_t tsMonitorInterval = 30; // seconds
// audit
int8_t tsEnableAudit = 1;
char tsAuditDbName[TSDB_DB_NAME_LEN] = "audit";
// stream
int8_t tsEnableStream = 1;
......@@ -1288,6 +1291,16 @@ static void doInitGlobalConfig(void) {
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
cfg.option = "audit";
cfg.ptr = &tsEnableAudit;
cfg.valType = TAOS_CFG_VTYPE_INT8;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = 0;
cfg.maxValue = 1;
cfg.ptrLength = 1;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
cfg.option = "stream";
cfg.ptr = &tsEnableStream;
cfg.valType = TAOS_CFG_VTYPE_INT8;
......
......@@ -1476,6 +1476,10 @@ static bool monConvDDLType2Str(int8_t type, char *buf, int32_t len) {
}
void monSaveAuditLog(int8_t type, const char *user, const char *obj, bool result) {
if (tsEnableAudit == 0) { //audit not enabled
return;
}
char sql[1024] = {0};
char typeStr[64] = {0};
......@@ -1502,9 +1506,9 @@ void monSaveAuditLog(int8_t type, const char *user, const char *obj, bool result
taos_free_result(res);
if (code != 0) {
monError("failed to save audit info, reason:%s, sql:%s", tstrerror(code), sql);
monError("failed to save audit ddl info, reason:%s, sql:%s", tstrerror(code), sql);
} else {
monDebug("successfully save audit info, sql:%s", sql);
monDebug("successfully save audit ddl info, sql:%s", sql);
}
}
......
......@@ -20,7 +20,7 @@
extern "C" {
#endif
#define TSDB_CFG_MAX_NUM 137
#define TSDB_CFG_MAX_NUM 138
#define TSDB_CFG_PRINT_LEN 23
#define TSDB_CFG_OPTION_LEN 24
#define TSDB_CFG_VALUE_LEN 41
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册