Commits (1)
......@@ -133,8 +133,8 @@ static int lputs(int level, const char* str)
mqtt_lputs(&mqtt, TOPIC_SERVER, level, str);
if(level <= LOG_ERR) {
char errmsg[1024];
errorlog(&scfg, &mqtt, level, startup == NULL ? NULL : startup->host_name, str);
SAFEPRINTF2(errmsg, "%s %s", server_abbrev, str);
SAFEPRINTF2(errmsg, "%-4s %s", server_abbrev, str);
errorlog(&scfg, &mqtt, level, startup == NULL ? NULL : startup->host_name, errmsg);
if(startup != NULL && startup->errormsg != NULL)
startup->errormsg(startup->cbdata, level, errmsg);
}
......
......@@ -60,7 +60,7 @@ extern "C" BOOL hacklog(scfg_t* cfg, struct mqtt* mqtt, const char* prot, const
if(text == NULL)
text= "";
snprintf(str, sizeof(str), "%s\t%s\t%u\t%s\t%s\t%s", prot, user, inet_addrport(addr), host, ip, text);
mqtt_pub_strval(mqtt, TOPIC_HOST, "hack", str);
mqtt_pub_strval(mqtt, TOPIC_BBS, "hack", str);
}
return true;
......@@ -116,7 +116,7 @@ extern "C" BOOL spamlog(scfg_t* cfg, struct mqtt* mqtt, char* prot, char* action
if(reason == NULL)
reason = (char*)"";
snprintf(str, sizeof(str), "%s\t%s\t%s\t%s\t%s\t%s\t%s", prot, action, host, ip_addr, from, to_user, reason);
mqtt_pub_strval(mqtt, TOPIC_HOST, "spam", str);
mqtt_pub_strval(mqtt, TOPIC_BBS, "spam", str);
}
return true;
......
......@@ -182,9 +182,9 @@ static int lputs(int level, const char* str)
mqtt_lputs(&mqtt, TOPIC_SERVER, level, str);
if(level <= LOG_ERR) {
char errmsg[1024];
errorlog(&scfg, &mqtt, level, startup == NULL ? NULL : startup->host_name, str);
stats.errors++;
SAFEPRINTF2(errmsg, "%s %s", server_abbrev, str);
SAFEPRINTF2(errmsg, "%-4s %s", server_abbrev, str);
errorlog(&scfg, &mqtt, level, startup == NULL ? NULL : startup->host_name, errmsg);
if(startup != NULL && startup->errormsg != NULL)
startup->errormsg(startup->cbdata, level, errmsg);
}
......
......@@ -209,8 +209,8 @@ int lputs(int level, const char* str)
mqtt_lputs(&mqtt, TOPIC_SERVER, level, str);
if(level <= LOG_ERR) {
char errmsg[1024];
errorlog(&scfg, &mqtt, level, startup==NULL ? NULL:startup->host_name, str);
SAFEPRINTF2(errmsg, "%s %s", server_abbrev, str);
SAFEPRINTF2(errmsg, "%-4s %s", server_abbrev, str);
errorlog(&scfg, &mqtt, level, startup==NULL ? NULL:startup->host_name, errmsg);
if(startup!=NULL && startup->errormsg!=NULL)
startup->errormsg(startup->cbdata,level,errmsg);
}
......@@ -235,8 +235,8 @@ int eputs(int level, const char *str)
if(level <= LOG_ERR) {
char errmsg[1024];
errorlog(&scfg, &mqtt, level, startup==NULL ? NULL:startup->host_name, str);
SAFEPRINTF(errmsg, "evnt %s", str);
errorlog(&scfg, &mqtt, level, startup==NULL ? NULL:startup->host_name, errmsg);
if(startup!=NULL && startup->errormsg!=NULL)
startup->errormsg(startup->cbdata, level, errmsg);
}
......
......@@ -533,7 +533,7 @@ int mqtt_errormsg(struct mqtt* mqtt, int level, const char* msg)
return MQTT_FAILURE;
++mqtt->error_count;
mqtt_pub_uintval(mqtt, TOPIC_SERVER, "error_count", mqtt->error_count);
return mqtt_pub_strval(mqtt, TOPIC_SERVER, "error", msg);
return mqtt_pub_strval(mqtt, TOPIC_BBS, "error", msg);
}
int mqtt_client_max(struct mqtt* mqtt, ulong count)
......
......@@ -116,8 +116,8 @@ static int lputs(int level, const char* str)
mqtt_lputs(&mqtt, TOPIC_SERVER, level, str);
if(level <= LOG_ERR) {
char errmsg[1024];
errorlog(&scfg, &mqtt, level, startup == NULL ? NULL : startup->host_name, str);
SAFEPRINTF2(errmsg, "%s %s", server_abbrev, str);
SAFEPRINTF2(errmsg, "%-4s %s", server_abbrev, str);
errorlog(&scfg, &mqtt, level, startup == NULL ? NULL : startup->host_name, errmsg);
if(startup != NULL && startup->errormsg != NULL)
startup->errormsg(startup->cbdata, level, errmsg);
}
......
......@@ -541,8 +541,8 @@ static int lputs(int level, const char* str)
mqtt_lputs(&mqtt, TOPIC_SERVER, level, str);
if(level <= LOG_ERR) {
char errmsg[1024];
errorlog(&scfg, &mqtt, level, startup == NULL ? NULL : startup->host_name, str);
SAFEPRINTF2(errmsg, "%s %s", server_abbrev, str);
SAFEPRINTF2(errmsg, "%-4s %s", server_abbrev, str);
errorlog(&scfg, &mqtt, level, startup == NULL ? NULL : startup->host_name, errmsg);
if(startup != NULL && startup->errormsg != NULL)
startup->errormsg(startup->cbdata, level, errmsg);
}
......