postfix_ii = { # # # # This was created to attampt to fix a number of problems with the old format, # without changing the existing format, as that would take too long and may not succeed. # A 'ground up' approach has been undertaken. # # # # # The name of the log format log.format.format_label = "Postfix II Log Format" log.miscellaneous.log_data_type = "syslog_required" log.miscellaneous.log_format_type = "mail_server" # The log is in this format if there is a match this regular expression log.format.autodetect_regular_expression = "postfix" #Search this many lines for the regex for auto-detect log.format.autodetect_lines = "100" # All log field parsing will be done using the parsing filters log.format.parse_only_with_filters = "true" # An entry in this log is called a "message" in the statistics statistics.miscellaneous.entry_name = "messages" # This disables the collection of unclosed entries log.format.collected_entry_lifespan = "0" # # # # # # Log fields log.fields = { from = { label = "$lang_stats.field_labels.from" type = "flat" index = 0 subindex = 0 } # from to = { label = "$lang_stats.field_labels.to" type = "flat" index = 0 subindex = 0 } # to size = { label = "$lang_stats.field_labels.size" type = "size" index = 0 subindex = 0 hierarchy_dividers = "" left_to_right = false leading_divider = "false" } # size user = { label = "$lang_stats.field_labels.user" type = "flat" index = 0 subindex = 0 } # user rbl_list = { label = "$lang_stats.field_labels.rbl_list" type = "flat" index = 0 subindex = 0 } # rbl_list client_hostname = { label = "$lang_stats.field_labels.client_hostname" type = "flat" index = 0 subindex = 0 } # client_hostname client_ip = { label = "$lang_stats.field_labels.client_ip" type = "flat" index = 0 subindex = 0 } # client_ip } # log.fields # # # # # # # Log Parsing Filters log.parsing_filters = { # This pulls out the Login lines where present in the logs. # Uncomment this line and the database field called "user" # to see this data in the report # do_b "" "" "" "" "" collect_multiple_fields_regexp "()LOGIN, user=([^,]+)," *KEY*,user "" "" goto_next_filter "" "" "" "" collapsed # rekey on client= lines. The syslog parses the date/time right before this, into the empty key, and we rekey here # to use the real key. # Note: for some reason, this was looking for message-id, even though the comment above says client=. client= comes first # and should be used, not message-id-- if you use message-id, it will lose the client= line information. # I've left the line below, commented out, in case there's a reason it was that way. # Note2: We've seen a lot of Postfix logs now which don't have a client-id either-- they have *nothing* but a from and to # line. In these cases, we can't be using message-id or client-id-- we have to use from=. So that's what we're doing now. # This loses client-id information, which is a shame, but counting all froms and tos is much more important! Hopefully, # in version 7 we can create a more flexible plug-in. # reverse_rekey_collected_entry "[ ]([0-9A-Z]+):() message-id=<" "" "" "" 1 = { label = "1" comment = "" value = "if (matches_regular_expression(current_log_line(), '[ ]([0-9A-Z]+):() from=')) then rekey_collected_entry($2, $1);" } # 1 # Parse from lines 2 = { label = "2" comment = "" value = "collect_fields_using_regexp('postfix/[^:]+: ([A-F0-9]+): from=<([^>]+)>, size=([0-9]+), nrcpt=[0-9] \\\\(queue active\\\\)$', '*KEY*,from,size')" } # 2 # Parse to/size lines 3 = { label = "3" comment = "" value = "collect_fields_using_regexp('postfix/[^:]+: ([A-F0-9]+): to=<([^>]+)>,[^,]*,[^,]*, status=sent \\\\(250 Message accepted for delivery\\\\)$', '*KEY*,to')" } # 3 # Parse reject lines (blank *KEY*) 4 = { label = "4" comment = "" value = "collect_fields_using_regexp('()postfix/[^:]+: [A-F0-9]+: reject: [A-Z]+ from ([^[]+)\\\\[([^]]+)\\\\]: [^;]+; Client host \\\\[[^]]+\\\\] blocked using ([^;]+); from=<([^>]+)> to=<([^>]+)> proto=[A-Z]+ helo=<[^>]+>', '*KEY*,client_hostname,client_ip,rbl_list,from,to')" } # 4 # Accept this log entry if it's a postfix/smtp reject (blocked) entry (blank *KEY*) 5 = { label = "5" comment = "" value = "accept_collected_entry_using_regexp('()postfix/[^:]+: [A-F0-9]+: reject:.*blocked using', false)" } # 5 # Accept this log entry if it's a postfix/smtp '250 Message accepted for delivery' lines 6 = { label = "6" comment = "" value = "accept_collected_entry_using_regexp('postfix/[^:]+: ([A-F0-9]+): to=[^,]*,[^,]*,[^,]*, status=sent \\\\(250 Message accepted for delivery\\\\)$', false)" } # 6 } # log.parsing_filters # # # # # # Database fields database.fields = { from = { label = "$lang_stats.field_labels.from" log_field = "from" type = "string" suppress_top = 0 suppress_bottom = 2 } # from to = { label = "$lang_stats.field_labels.to" log_field = "to" type = "string" suppress_top = 0 suppress_bottom = 2 } # to # user 0 2 false "" rbl_list = { label = "$lang_stats.field_labels.rbl_list" log_field = "rbl_list" type = "string" suppress_top = 0 suppress_bottom = 2 } # rbl_list client_hostname = { label = "$lang_stats.field_labels.client_hostname" log_field = "client_hostname" type = "string" suppress_top = 0 suppress_bottom = 2 } # client_hostname client_ip = { label = "$lang_stats.field_labels.client_ip" log_field = "client_ip" type = "string" suppress_top = 0 suppress_bottom = 2 } # client_ip } # database.fields database.numerical_fields = { messages = { label = "$lang_stats.field_labels.messages" default = true requires_log_field = false type = "int" display_format_type = "integer" entries_field = true } # messages size = { label = "$lang_stats.field_labels.size" default = false requires_log_field = true log_field = "size" type = "float" display_format_type = "bandwidth" } # size } # database.numerical_fields log.filters = { mark_entry = { label = '$lang_admin.log_filters.mark_entry_label' comment = '$lang_admin.log_filters.mark_entry_comment' value = 'messages = 1;' } # mark_entry } # log.filters create_profile_wizard_options = { # How the reports should be grouped in the report menu report_groups = { date_time_group = "" from = true to = true rbl_list = true client_hostname = true client_ip = true } # report_groups } # create_profile_wizard_options not_supported = { visitors = true sessions = true pageviews = true } # not_supported } # postfix_ii