diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 6733be09ae..4aeb372286 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -2429,6 +2429,9 @@ function events_create_event( $source = get_product_name(); } + $custom_data = base64_decode($custom_data); + $custom_data = mysql_escape_string_sql($custom_data); + $table_events = 'tevento'; if (is_metaconsole()) { $table_events = 'tmetaconsole_event'; diff --git a/pandora_console/operation/events/export_csv.php b/pandora_console/operation/events/export_csv.php index 9f6b14c5fa..d3f9c7005a 100644 --- a/pandora_console/operation/events/export_csv.php +++ b/pandora_console/operation/events/export_csv.php @@ -183,6 +183,29 @@ try { ); break; + case 'custom_data': + $custom_data_array = json_decode( + $row[$key], + true + ); + + $custom_data = ''; + $separator = ($config['csv_divider'] === ';') ? ',' : ';'; + + if ($custom_data_array !== null) { + array_walk( + $custom_data_array, + function (&$value, $field) { + $value = $field.'='.$value; + } + ); + + $custom_data = implode($separator, $custom_data_array); + } + + echo io_safe_output($custom_data); + break; + default: echo io_safe_output($row[$key]); break; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 2180863dd0..1bcd2e0519 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -4301,9 +4301,6 @@ sub cli_create_event() { print_log "[INFO] Adding event '$event' for agent '$agent_name' \n\n"; - # Base64 encode custom data - $custom_data = encode_base64 ($custom_data, ''); - pandora_event ($conf, $event, $id_group, $id_agent, $severity, $id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, safe_input($comment), $id_extra, $tags, $c_instructions, $w_instructions, $u_instructions, $custom_data);