[Bro-Dev] #476: Problem with logging &optional subrecords

Bro Tracker bro at tracker.bro-ids.org
Thu Jun 16 10:49:15 PDT 2011

#476: Problem with logging &optional subrecords
 Reporter:  seth     |      Owner:
     Type:  Problem  |     Status:  new
 Priority:  High     |  Milestone:  Bro1.6
Component:  Bro      |    Version:
 Keywords:  logging  |
 The logging framework has a problem when you try to log a subrecord that
 is &optional.  No errors are generated, but the logging framework just
 drops the log line completely.  In the code below, only the second
 Log::write call works.

 redef enum Log::ID += { TESTING };

 type Foo: record {
         val1: count;
         val2: count;
 } &log;

 type Bar: record {
         a: Foo   &log &optional;
         b: count &log;

 event bro_init()
         Log::create_stream(TESTING, [$columns=Bar]);

         # This doesn't print anything to the log.
         Log::write(TESTING, [$b=6]);

         # This works.
         Log::write(TESTING, [$a=[$val1=1,$val2=2], $b=3]);

 This code prints out a file containing the following:

 # a.val1        a.val2  b
 1       2       3

Ticket URL: <http://tracker.bro-ids.org/bro/ticket/476>
Bro Tracker <http://tracker.bro-ids.org/bro>
Bro Issue Tracker

More information about the bro-dev mailing list