# Copyright (c) 2010 Flowerfire, Inc. All Rights Reserved. mikrotik_router = { plugin_version = "1.1" # Initial creation - 1.0 # 2011-06-24 - 1.0.1 - MSG - Edited info lines. # 2015-06-03 - 1.1 - gas - added support for variant info.1.manufacturer = "MikroTik" info.1.device = "Router" info.1.version.1 = "" # The name of the log format log.format.format_label = "Mikrotik Router Log Format" log.miscellaneous.log_data_type = "syslog_required" log.miscellaneous.log_format_type = "network_device" # The log is in this format if any of the first ten lines match this regular expression #log.format.autodetect_regular_expression = "[a-z]+->[A-Z]+, [a-z]+:[a-z]+, [a-z]+:[a-z]+, [a-z]+ [A-Z]+ \\([A-Z]+\\), [0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+:[0-9]+->[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+:[0-9]+, len [0-9]+" log.format.autodetect_regular_expression = "[0-9.]+:[0-9]+->[0-9.]+:[0-9]+, len [0-9]+" # Log fields log.fields = { type = "" source_interface = "" destination_interface = "" protocol = "" source_ip.type = "host" source_port = "" destination_ip = "" destination_port = "" length = "" source_mac = "" } # log.fields log.parsing_filters.parse = ` if (matches_regular_expression(v.syslog_message, '^([a-z]+->[A-Z]+), ([a-z]+:[a-z]+), ([a-z]+:[a-z]+), [a-z]+ ([A-Z]+) \\([A-Z]+\\), ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+):([0-9]+)->([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+):([0-9]+), len ([0-9]+)')) then ( set_collected_field('', 'type', $1); set_collected_field('', 'source_interface', $2); set_collected_field('', 'destination_interface', $3); set_collected_field('', 'protocol', $4); set_collected_field('', 'source_ip', $5); set_collected_field('', 'source_port', $6); set_collected_field('', 'destination_ip', $7); set_collected_field('', 'destination_port', $8); set_collected_field('', 'length', $9); accept_collected_entry('', false); ); # alternate format: # 2015-05-17 18:04:29 Local7.Debug 103.16.69.12 firewall,info mikrotik: mikrotik forward: in: out:WAN, proto TCP (SYN), 172.16.0.45:51383->103.243.222.9:80, len 60 else if (matches_regular_expression(v.syslog_message, '[^,]+,[^ ]+ [^:]+: (.*)$')) then ( v.mikrotik_line = $1; if (matches_regular_expression(v.mikrotik_line, '([^:]+): ([^:]+):([^ ]+) ([^:]+):([^,]+), src-mac ([^,]+), ([^ ]+) ([^,]+,[^)]+.|[^,]+), ([^:]+):([0-9]+)->([^:]+):([0-9]+), ([^ ]+) ([^$]+)$')) then ( set_collected_field('', 'type', $1); set_collected_field('', 'source_interface', replace_all(replace_all($3, '<', ''), '>', '')); set_collected_field('', 'destination_interface', replace_all(replace_all($5, '<', ''), '>', '')); set_collected_field('', 'source_mac', $6); set_collected_field('', 'protocol', $8); set_collected_field('', 'source_ip', $9); set_collected_field('', 'source_port', $10); set_collected_field('', 'destination_ip', $11); set_collected_field('', 'destination_port', $12); set_collected_field('', 'length', $14); ); else if (matches_regular_expression(v.mikrotik_line, '([^:]+): ([^:]+):([^ ]+) ([^:]+):([^,]+), ([^ ]+) ([^,]+,[^)]+.|[^,]+), ([^:]+):([0-9]+)->([^:]+):([0-9]+), ([^ ]+) ([^$]+)$')) then ( set_collected_field('', 'type', $1); set_collected_field('', 'source_interface', replace_all(replace_all($3, '<', ''), '>', '')); set_collected_field('', 'destination_interface', replace_all(replace_all($5, '<', ''), '>', '')); set_collected_field('', 'protocol', $7); set_collected_field('', 'source_ip', $8); set_collected_field('', 'source_port', $9); set_collected_field('', 'destination_ip', $10); set_collected_field('', 'destination_port', $11); set_collected_field('', 'length', $13); ); accept_collected_entry('', false); ); ` # Database fields database.fields = { type = "" source_interface = "" destination_interface = "" protocol = "" source_ip = "" location = "" source_port = "" destination_ip = "" destination_port = "" source_mac = "" } # database.fields # Log Filters log.filters = { mark_entry = { label = '$lang_admin.log_filters.mark_entry_label' comment = '$lang_admin.log_filters.mark_entry_comment' value = 'packets = 1;' } # mark_entry } # log.filters database.numerical_fields = { packets = { label = "$lang_stats.field_labels.packets" default = true requires_log_field = false type = "int" display_format_type = "integer" entries_field = true } # packets unique_source_ips = { label = "$lang_stats.field_labels.unique_source_ips" default = false requires_log_field = true log_field = "source_ip" type = "unique" display_format_type = "integer" } # unique_source_ips length = { label = "$lang_stats.field_labels.length" default = false requires_log_field = true log_field = "length" type = "int" integer_bits = 64 display_format_type = "bandwidth" } # length } # database.numerical_fields create_profile_wizard_options = { # How the reports should be grouped in the report menu report_groups = { date_time_group = "" } # report_groups } # create_profile_wizard_options } # mikrotik_router