Re: [evlog-dev] binary data with evlsend?
James Keniston <[email protected]> Fri, 31 Jan 2003 12:04:37 -0800
| Newsgroups | gmane.linux.kernel.event-logging |
|---|---|
| Message-ID | <[email protected]> |
Steve Woodruff wrote:
> Hi Jim,
>
> Well, yes i'd like to see it implemented for
> two reasons:
>
> 1) the man page says it can be done
> 2) we'd like to post some binary events
> from shell scripts
So I guess eliminating the --binary option from the man page wouldn't be
your preferred fix. :-)
I am authorized to offer you the following deal:
- We implement the evlsend --binary option Real Soon Now. (It won't be in
our 2/7/03 release, but we can negotiate a date for an unofficial code
drop.)
- Based on your recently acquired expertise on adding an evlog plugin, you
write up a plugin how-to document. This document should include and (as
necessary) augment the plugin instructions in the README file that Hien
and/or Larry provided you. Hien checked that file in today as
user/cmd/evlogd/sample_be/README.
>
> Along the same lines.... i setup a template:
>
> facility "moo";
> event_type 0x9998;
> attributes {
> int data1;
> int data2;
> }
> format string "(%data1%.......%data2%)"
> END
>
> and then did this from code:
>
> evl_log_write(facility, event_type, severity, 0,
> "int", "100", "int", "200", "endofdata");
That line should be
"int", 100, "int", 200, "endofdata");
or, if you prefer,
"2*int", 100, 200, "endofdata");
>
> In my evlog plugin, i do something similar to:
>
> sprintf(format, "(%%data1%%.......%%data2%%)");
> status = evl_format_evrec_sprintf(entry, varbuf,
> format, recbuf, sizeof(recbuf), (size_t *)&reqlen);
>
> two things:
>
> 1) how can i get around having to know the format
> string? that complicates things!
If all you want to do is get a formatted version of the variable portion of
the record, and you have the corresponding template in place, then this
should do the trick:
evl_format_evrec_variable(entry, varbuf, recbuf, sizeof(recbuf),
&reqlen);
evl_format_evrec_variable() finds and applies the appropriate template, if
any.
If I've misunderstood your intent, or my explanation is unclear, please
feel free to call me. I'm the perpetrator of almost all the template and
record-formatting code.
> 2) the value stored in recbuf is never right. It
> is usually "(0.......0)" Am i missing something?
It's probably because evl_log_write() wrote char pointers (e.g., "100")
when it thought it was writing ints (e.g., 100). See above.
>
> Thanks!
>
> /steve
Jim Keniston
LTC - Beaverton, OR
503-578-9854
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com