It is really not a simple question to answer, because it is unclear what you are asking for. If you want the length of the JSON string that will get written to elasticsearch then serialize the event and check the length of the string.
If you want an approximation of the size of the entire event then you could re-purpose some code.
If you want to know how much memory is allocated for an object that will vary between JVMs, and depend on what other objects exist (think string pools).
Note that
ruby { code => 'event.set("size", event.to_s.bytesize)' }
does not do what you want because event.to_s does not do what you expect.