Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
64cc76ca
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
64cc76ca
编写于
10月 28, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add enable button
上级
00c3be67
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
24 deletion
+44
-24
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+4
-1
src/common/src/tglobal.c
src/common/src/tglobal.c
+14
-1
src/plugins/monitor/src/monMain.c
src/plugins/monitor/src/monMain.c
+6
-2
src/util/inc/tconfig.h
src/util/inc/tconfig.h
+1
-1
src/util/src/tconfig.c
src/util/src/tconfig.c
+19
-19
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
64cc76ca
...
...
@@ -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
;
...
...
src/common/src/tglobal.c
浏览文件 @
64cc76ca
...
...
@@ -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
;
...
...
src/plugins/monitor/src/monMain.c
浏览文件 @
64cc76ca
...
...
@@ -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
);
}
}
...
...
src/util/inc/tconfig.h
浏览文件 @
64cc76ca
...
...
@@ -20,7 +20,7 @@
extern
"C"
{
#endif
#define TSDB_CFG_MAX_NUM 13
7
#define TSDB_CFG_MAX_NUM 13
8
#define TSDB_CFG_PRINT_LEN 23
#define TSDB_CFG_OPTION_LEN 24
#define TSDB_CFG_VALUE_LEN 41
...
...
src/util/src/tconfig.c
浏览文件 @
64cc76ca
...
...
@@ -32,20 +32,20 @@ int32_t tsGlobalConfigNum = 0;
}
static
char
*
tsGlobalUnit
[]
=
{
" "
,
"(%)"
,
"(GB)"
,
"(Mb)"
,
"(byte)"
,
"(s)"
,
" "
,
"(%)"
,
"(GB)"
,
"(Mb)"
,
"(byte)"
,
"(s)"
,
"(ms)"
};
char
*
tsCfgStatusStr
[]
=
{
"none"
,
"system default"
,
"config file"
,
"taos_options"
,
"none"
,
"system default"
,
"config file"
,
"taos_options"
,
"program argument list"
};
...
...
@@ -335,7 +335,7 @@ bool taosReadConfigOption(const char *option, char *value, char *value2, char *v
taosReadDataDirCfg
(
value
,
value2
,
value3
);
ret
=
true
;
}
else
{
ret
=
false
;
ret
=
false
;
}
break
;
default:
...
...
@@ -365,8 +365,8 @@ void taosReadGlobalLogCfg() {
wordfree
(
&
full_path
);
return
;
}
if
(
full_path
.
we_wordv
!=
NULL
&&
full_path
.
we_wordv
[
0
]
!=
NULL
)
{
if
(
full_path
.
we_wordv
!=
NULL
&&
full_path
.
we_wordv
[
0
]
!=
NULL
)
{
if
(
strlen
(
full_path
.
we_wordv
[
0
])
>=
TSDB_FILENAME_LEN
)
{
printf
(
"
\n
config file: %s path overflow max len %d, all variables are set to default
\n
"
,
full_path
.
we_wordv
[
0
],
TSDB_FILENAME_LEN
-
1
);
wordfree
(
&
full_path
);
...
...
@@ -380,7 +380,7 @@ void taosReadGlobalLogCfg() {
wordfree
(
&
full_path
);
taosReadLogOption
(
"logDir"
,
tsLogDir
);
sprintf
(
fileName
,
"%s/taos.cfg"
,
configDir
);
fp
=
fopen
(
fileName
,
"r"
);
if
(
fp
==
NULL
)
{
...
...
@@ -391,10 +391,10 @@ void taosReadGlobalLogCfg() {
ssize_t
_bytes
=
0
;
size_t
len
=
1024
;
line
=
calloc
(
1
,
len
);
while
(
!
feof
(
fp
))
{
memset
(
line
,
0
,
len
);
option
=
value
=
NULL
;
olen
=
vlen
=
0
;
...
...
@@ -443,7 +443,7 @@ bool taosReadGlobalCfg() {
ssize_t
_bytes
=
0
;
size_t
len
=
1024
;
line
=
calloc
(
1
,
len
);
while
(
!
feof
(
fp
))
{
memset
(
line
,
0
,
len
);
...
...
@@ -457,7 +457,7 @@ bool taosReadGlobalCfg() {
}
line
[
len
-
1
]
=
0
;
paGetToken
(
line
,
&
option
,
&
olen
);
if
(
olen
==
0
)
continue
;
option
[
olen
]
=
0
;
...
...
@@ -495,7 +495,7 @@ void taosPrintGlobalCfg() {
SGlobalCfg
*
cfg
=
tsGlobalConfig
+
i
;
if
(
tscEmbedded
==
0
&&
!
(
cfg
->
cfgType
&
TSDB_CFG_CTYPE_B_CLIENT
))
continue
;
if
(
cfg
->
cfgType
&
TSDB_CFG_CTYPE_B_NOT_PRINT
)
continue
;
int
optionLen
=
(
int
)
strlen
(
cfg
->
option
);
int
blankLen
=
TSDB_CFG_PRINT_LEN
-
optionLen
;
blankLen
=
blankLen
<
0
?
0
:
blankLen
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录