1
0
Fork 0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-06-01 18:06:25 +02:00

Some code clean up with redis_prefix

This commit is contained in:
Pavel Odintsov 2015-08-17 23:14:32 +02:00
parent f8e453c110
commit 6a05a09f99
2 changed files with 8 additions and 6 deletions

View File

@ -155,7 +155,9 @@ redis_enabled = no
# Reddis configuration
redis_port = 6379
redis_host = 127.0.0.1
redis_prefix = off
# You could specify custom prefix here
redis_prefix = mydc1
# ExaBGP could announce blocked IPs with BGP protocol
exabgp = off

View File

@ -1047,7 +1047,7 @@ bool load_configuration_file() {
redis_host = configuration_map["redis_host"];
}
if (configuration_map["redis_prefix"] != "off") {
if (configuration_map.count("redis_prefix") != 0) {
redis_prefix = configuration_map["redis_prefix"];
}
@ -2870,7 +2870,7 @@ void call_ban_handlers(uint32_t client_ip, attack_details& current_attack, std::
std::string redis_key_name = client_ip_as_string + "_information";
if (!redis_prefix.empty()) {
std::string redis_key_name = redis_prefix + "_" + client_ip_as_string + "_information";
redis_key_name = redis_prefix + "_" + client_ip_as_string + "_information";
}
logger << log4cpp::Priority::INFO << "Start data save in redis in key: " << redis_key_name;
@ -2884,7 +2884,7 @@ void call_ban_handlers(uint32_t client_ip, attack_details& current_attack, std::
std::string redis_key_name = client_ip_as_string + "_flow_dump";
if (!redis_prefix.empty()) {
std::string redis_key_name = redis_prefix + "_" + client_ip_as_string + "_flow_dump";
redis_key_name = redis_prefix + "_" + client_ip_as_string + "_flow_dump";
}
logger << log4cpp::Priority::INFO << "Start data save in redis in key: " << redis_key_name;
@ -3450,8 +3450,8 @@ void call_attack_details_handlers(uint32_t client_ip, attack_details& current_at
std::string redis_key_name = client_ip_as_string + "_packets_dump";
if (!redis_prefix.empty()) {
std::string redis_key_name = redis_prefix + "_" + client_ip_as_string + "_packets_dump";
}
redis_key_name = redis_prefix + "_" + client_ip_as_string + "_packets_dump";
}
logger << log4cpp::Priority::INFO << "Start data save in redis for key: " << redis_key_name;
boost::thread redis_store_thread(store_data_in_redis, redis_key_name, attack_fingerprint);