modify log format and remove otlv

This commit is contained in:
lnk
2026-01-06 10:23:43 +08:00
parent 79676aa90d
commit 6e74f21167
12 changed files with 144 additions and 129 deletions

View File

@@ -972,7 +972,7 @@ int parse_set(const std::string& json_str) {
//进程号为0或者进程号匹配上
std::cout << "msg index:"<< index_value <<" self index:" << g_front_seg_index << std::endl;
DIY_INFOLOG("process","【NORMAL】前置的%s%d号进程处理topic:%s_%s的进程控制消息",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_SET.c_str());
DIY_INFOLOG("process","前置的%s%d号进程处理topic:%s_%s的进程控制消息",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_SET.c_str());
if (code_str == "set_process") {
@@ -998,7 +998,7 @@ int parse_set(const std::string& json_str) {
}
execute_bash(fun, processNum, frontType);
DIY_WARNLOG_CODE("process",LOG_CODE_PROCESS_CONTROL,"【WARN】前置的%s%d号进程执行指令:%s,reset表示重启所有进程,add表示添加进程",get_front_msg_from_subdir(), g_front_seg_index,fun.c_str());
DIY_WARNLOG_CODE("process",LOG_CODE_PROCESS_CONTROL,"前置的%s%d号进程执行指令:%s,reset表示重启所有进程,add表示添加进程",get_front_msg_from_subdir(), g_front_seg_index,fun.c_str());
//脚本在3秒后执行
//回复消息
@@ -1020,7 +1020,7 @@ int parse_set(const std::string& json_str) {
send_reply_to_kafka(guid,"1","收到删除进程指令,这个进程将会重启 ");
//上送日志
DIY_WARNLOG_CODE("process",LOG_CODE_PROCESS_CONTROL,"【WARN】前置的%s%d号进程执行指令:%s,即将重启",get_front_msg_from_subdir(), g_front_seg_index,fun.c_str());
DIY_WARNLOG_CODE("process",LOG_CODE_PROCESS_CONTROL,"前置的%s%d号进程执行指令:%s,即将重启",get_front_msg_from_subdir(), g_front_seg_index,fun.c_str());
apr_sleep(apr_time_from_sec(10));
::_exit(-1039); //进程退出
@@ -1061,7 +1061,7 @@ int parse_set(const std::string& json_str) {
(proindex >= 10 && proindex < 100)){ //单连测试用的进程号应该大于10小于100
execute_bash_debug(fun, ip, frontType,proindex);
DIY_WARNLOG("process","【WARN】前置的%s%d号进程执行指令:%s,start开启单连进程,delete杀死单连进程",get_front_msg_from_subdir(), g_front_seg_index,fun.c_str());
DIY_WARNLOG("process","前置的%s%d号进程执行指令:%s,start开启单连进程,delete杀死单连进程",get_front_msg_from_subdir(), g_front_seg_index,fun.c_str());
}
else{
std::cout << "param is not executable" <<std::endl;
@@ -1400,7 +1400,7 @@ int parse_log(const std::string& json_str) {
return 0;
}
DIY_INFOLOG("process","【NORMAL】前置的%s%d号进程处理日志上送消息",get_front_msg_from_subdir(), g_front_seg_index);
DIY_INFOLOG("process","前置的%s%d号进程处理日志上送消息",get_front_msg_from_subdir(), g_front_seg_index);
//进程号和匹配上
std::cout << "msg index:"<< processNo <<" self index:" << g_front_seg_index << std::endl;
@@ -1509,7 +1509,7 @@ int parse_control(const std::string& json_str, const std::string& output_dir) {
std::cout << "msg index:"<< process_No <<" self index:" << g_front_seg_index << std::endl;
//记录日志
DIY_INFOLOG("process","【NORMAL】前置的%s%d号进程处理topic:%s_%s的台账更新消息",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_UD.c_str());
DIY_INFOLOG("process","前置的%s%d号进程处理topic:%s_%s的台账更新消息",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_UD.c_str());
//匹配后响应收到台账更新消息
//除了回复收到消息,执行结束后还要回复结果
@@ -1777,7 +1777,7 @@ int myMessageCallbackrtdata(CPushConsumer* consumer, CMessageExt* msg)
}
else{
//记录日志
DIY_INFOLOG("process","【NORMAL】前置消费topic:%s_%s的实时触发消息",FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_RT.c_str());
DIY_INFOLOG("process","前置消费topic:%s_%s的实时触发消息",FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_RT.c_str());
// 处理消息(例如,打印消息内容)
std::cout << "rt data Callback received message: " << body << std::endl;
@@ -1796,7 +1796,7 @@ int myMessageCallbackrtdata(CPushConsumer* consumer, CMessageExt* msg)
if (!parseJsonMessageRT(body, devid, line, realData, soeData, limit)) {
std::cerr << "Failed to parse the JSON message." << std::endl;
//记录日志
DIY_ERRORLOG_CODE("process",LOG_CODE_RT_DATA,"【ERROR】前置消费topic:%s_%s的实时触发消息失败,消息的json格式不正确",FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_RT.c_str());
DIY_ERRORLOG_CODE("process",LOG_CODE_RT_DATA,"前置消费topic:%s_%s的实时触发消息失败,消息的json格式不正确",FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_RT.c_str());
return E_RECONSUME_LATER;
}
@@ -1814,7 +1814,7 @@ int myMessageCallbackrtdata(CPushConsumer* consumer, CMessageExt* msg)
}
// 创建 XML 文件
if (!createXmlFile(dev_index, mp_index, realData, soeData, limit,"new")) {
DIY_ERRORLOG_CODE("process",LOG_CODE_RT_DATA,"【ERROR】前置无法创建实时数据触发文件");
DIY_ERRORLOG_CODE("process",LOG_CODE_RT_DATA,"前置无法创建实时数据触发文件");
std::cerr << "Failed to create the XML file." << std::endl;
return E_RECONSUME_LATER;
}
@@ -1855,7 +1855,7 @@ int myMessageCallbackupdate(CPushConsumer* consumer, CMessageExt* msg)
//处理台账更新消息
std::string updatefilepath = "/home/pq/FeProject/etc/ledgerupdate";
if(parse_control(body,updatefilepath)){
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER_UPDATE,"【ERROR】前置的%s%d号进程处理topic:%s_%s的台账更新消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_UD.c_str());
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER_UPDATE,"前置的%s%d号进程处理topic:%s_%s的台账更新消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_UD.c_str());
}
}
@@ -1891,7 +1891,7 @@ int myMessageCallbackset(CPushConsumer* consumer, CMessageExt* msg)
//处理进程更新消息
if(parse_set(body)){
DIY_ERRORLOG_CODE("process",LOG_CODE_PROCESS_CONTROL,"【ERROR】前置的%s%d号进程处理topic:%s_%s的进程控制消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_SET.c_str());
DIY_ERRORLOG_CODE("process",LOG_CODE_PROCESS_CONTROL,"前置的%s%d号进程处理topic:%s_%s的进程控制消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_SET.c_str());
}
}
@@ -1927,7 +1927,7 @@ int myMessageCallbacklog(CPushConsumer* consumer, CMessageExt* msg)
//处理进程更新消息
if(parse_log(body)){
DIY_ERRORLOG_CODE("process",LOG_CODE_LOG_REQUEST,"【ERROR】前置的%s%d号进程处理topic:%s_%s的日志上送消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_LOG.c_str());
DIY_ERRORLOG_CODE("process",LOG_CODE_LOG_REQUEST,"前置的%s%d号进程处理topic:%s_%s的日志上送消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_LOG.c_str());
}
}
@@ -1976,7 +1976,7 @@ int myMessageCallbackrecall(CPushConsumer* consumer, CMessageExt* msg)
}
else{
std::cerr << "recall data is NULL." << std::endl;
DIY_ERRORLOG_CODE("process",LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程处理topic:%s_%s的补招触发消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_RC.c_str());
DIY_ERRORLOG_CODE("process",LOG_CODE_RECALL,"前置的%s%d号进程处理topic:%s_%s的补招触发消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_RC.c_str());
}
}