mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Added protocol description functions that provide a super compressed log representation.
This commit is contained in:
parent
4dd4c5344e
commit
0bfdcc1fbc
13 changed files with 190 additions and 75 deletions
|
@ -72,7 +72,10 @@ export {
|
|||
## ALL_HOSTS - always capture the entire path.
|
||||
## NO_HOSTS - never capture the path.
|
||||
const mail_path_capture = ALL_HOSTS &redef;
|
||||
|
||||
|
||||
## Create an extremely shortened representation of a log line.
|
||||
global describe: function(rec: Info): string;
|
||||
|
||||
global log_smtp: event(rec: Info);
|
||||
}
|
||||
|
||||
|
@ -268,3 +271,29 @@ event connection_state_remove(c: connection) &priority=-5
|
|||
if ( c?$smtp )
|
||||
smtp_message(c);
|
||||
}
|
||||
|
||||
function describe(rec: Info): string
|
||||
{
|
||||
if ( rec?$mailfrom && rec?$rcptto )
|
||||
{
|
||||
local one_to = "";
|
||||
for ( to in rec$rcptto )
|
||||
{
|
||||
one_to = to;
|
||||
break;
|
||||
}
|
||||
local abbrev_subject = "";
|
||||
if ( rec?$subject )
|
||||
{
|
||||
if ( |rec$subject| > 20 )
|
||||
{
|
||||
abbrev_subject = rec$subject[0:20] + "...";
|
||||
}
|
||||
}
|
||||
|
||||
return fmt("%s -> %s%s%s", rec$mailfrom, one_to,
|
||||
(|rec$rcptto|>1 ? fmt(" (plus %d others)", |rec$rcptto|-1) : ""),
|
||||
(abbrev_subject != "" ? fmt(": %s", abbrev_subject) : ""));
|
||||
}
|
||||
return "";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue