I guess it makes sense when you send me the code and give the line number where you have the issue. I can't promise, but I'll try to give a good suggestion in the course of the day.
One important thing you need to think about is that pMsg does NOT necessarily use cstr objects to represent the entities. For example (IIRC), raw message is kept in a different buffer, and you cannot use cstr methods on that buffer. %msg% is actually not stored at all, it is taken from rawmsg. There is a whole lot of this kind of optimization done inside the message object. I guess this is what is hitting you. Rainer > -----Original Message----- > From: [email protected] [mailto:rsyslog- > [email protected]] On Behalf Of [email protected] > Sent: Monday, January 17, 2011 9:43 AM > To: rsyslog-users > Subject: Re: [rsyslog] message manipulation in a parser > > On Mon, 17 Jan 2011, Rainer Gerhards wrote: > > > David Lang wrote: > >> Rainer, > >> I'm testing the cisconames parser, and I've almost got everything > >> working (it looks like a total of 2 bugs in the initial code I sent > >> you), > >> but I'm running into problems trying to truncate a string. > >> > >> in the message parser, what would I pass to rsCStrTruncate() to > tuncate > >> 2 > >> characters from the incomeing message? > > > > I've just checked the code. It's the number of characters to > truncate. So you > > need to pass in "2". > > > > Code in question: > > > http://git.adiscon.com/?p=rsyslog.git;a=blob;f=runtime/stringbuf.c;h=f4 > a9caae > > d62d7ad9bca0deaf4728298cc40b5c2d;hb=HEAD#l435 > > the problem I'm having is figuring out what to use for the pointer to > the > string. so far everything I've tried is wrong and results in a > segfault. > > I'm assuming that the right answer is pMsg->something, but I haven't > figured out what the something is. > > David Lang > _______________________________________________ > rsyslog mailing list > http://lists.adiscon.net/mailman/listinfo/rsyslog > http://www.rsyslog.com _______________________________________________ rsyslog mailing list http://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com

