[Bro-Dev] [JIRA] (BIT-1324) default_path_func does weird things to underscores

Seth Hall (JIRA) jira at bro-tracker.atlassian.net
Mon Mar 16 11:11:00 PDT 2015


    [ https://bro-tracker.atlassian.net/browse/BIT-1324?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19961#comment-19961 ] 

Seth Hall edited comment on BIT-1324 at 3/16/15 1:10 PM:
---------------------------------------------------------

I think I like this idea, but I have a slightly modified request...

Keep the create_stream function as it is...
{code}
global Log::create_stream: function(id: Log::ID, stream: Log::Stream) : bool;
{code}

But extend the definition of Log::Stream
{code}
type Log::Stream: record {
    <stuff that's there now>
    path: string &optional;
};
{code}

How about that? It'll keep existing code working (which I think you were aiming for?) and avoid us creating a new function in the Logging framework api.


was (Author: seth):
I think I like this idea, but I have a slightly modified request...

Keep the create_stream function as it is...
{code}
global Log::create_stream: function(id: Log::ID, stream: Log::Stream) : bool;
{code}

But extend the definition of Log::Stream
{code}
type Log::Stream: record {
    <stuff that's there now>
    path: string &optional;
};
{code}

How about that?

> default_path_func does weird things to underscores
> --------------------------------------------------
>
>                 Key: BIT-1324
>                 URL: https://bro-tracker.atlassian.net/browse/BIT-1324
>             Project: Bro Issue Tracker
>          Issue Type: Problem
>          Components: Bro
>            Reporter: Justin Azoff
>            Assignee: Jon Siwek
>            Priority: Low
>              Labels: logging
>             Fix For: 2.4
>
>
> The following script creates a 
> {noformat}
> foo__b_ar.log
> {noformat}
>  
> instead of the expected {noformat}foo_bar{noformat}
> {code}
> module FOO_BAR;
> export {
>     redef enum Log::ID += { LOG };
>     type Info: record {
>       ts: time &log;
>       msg: string &log;
>     };
> }
> event bro_init() {
>     Log::create_stream(LOG, [$columns=Info]);
>     local l = [$ts = network_time(), $msg="hello"];
>     Log::write(LOG, l);
>     print "Logged";
> }
> {code}
> The problem is in script land in default_path_func
> {code}
>     local module_parts = split_string_n("FOO_BAR", /[^A-Z][A-Z][a-z]*/, T, 4);
>     print module_parts;
> {code}
> outputs 
> {code}
> [FOO, _B, AR]
> {code}



--
This message was sent by Atlassian JIRA
(v6.4-OD-15-055#64014)


More information about the bro-dev mailing list