>From phone: i think null is returned if field is not present. Must check this 
>b4 using.

----- Ursprüngliche Nachricht -----
Von: Champ Clark III [Softwink] <[email protected]>
Gesendet: Mittwoch, 15. Dezember 2010 19:59
An: rsyslog-users <[email protected]>
Betreff: Re: [rsyslog] liblognorm problems...


        I'm obviously missing something.. Here's my brief code (if you
need more info,  I'll be happy to post).  This is simply my PoC code.
Anyways....

--<snip>---

struct ee_field *field = NULL;
es_str_t *str2;

--<snip>---

str = es_newStrFromCStr(buf, strlen(buf));
ln_normalize(ctx, str, &event);
es_emptyStr(str);
ee_fmtEventToRFC5424(event, &str);
cstr = es_str2cstr(str,NULL);
printf("normalized: '%s'\n", cstr); /* Yay */

/* We start breaking stuff below here */

field = ee_getEventField(event, str);
str2 = ee_getFieldValueAsStr(field, 0);  /* <-- Breaks here */
cstr = es_str2cstr(str2, NULL);

printf("Field: %s\n", cstr);

--<snip>--- 

        Here's the output from when the PoC code is executed.  This is 
with --enable-debug on the libraries.... 

--<snip>---

normalized: '[...@115 port="48973" ip="192.168.0.1" tag="sshd[4416\]" 
host="bundy" date="Dec 10 12:13:50"]'
normalizer: fieldbucket.c:136: ee_getFieldValueAsStr: Assertion `field != 
((void *)0)' failed.
Aborted

--<snip>---

        I've been reading over the docs,  but I'm obviously missing something
really simple.  It'd be my guess that ee_getEventField() is actually where
my problem is.  Sorry for the silly question.

-- 
        Champ Clark III | Softwink, Inc | 800-538-9357 x 101
                     http://www.softwink.com

GPG Key ID: 58A2A58F
Key fingerprint = 7734 2A1C 007D 581E BDF7  6AD5 0F1F 655F 58A2 A58F
If it wasn't for C, we'd be using BASI, PASAL and OBOL.
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com

Reply via email to