Method: LogStash::Event#sprintf
- Defined in:
- lib/logstash/event.rb
#sprintf(format) ⇒ Object
sprintf. This could use a better method name. The idea is to take an event and convert it to a string based on any format values, delimited by %foo where ‘foo’ is a field or metadata member.
For example, if the event has type == “foo” and host == “bar” then this string:
"type is %{type} and source is %{host}"
will return
"type is foo and source is bar"
If a %name value is an array, then we will join by ‘,’ If a %name value does not exist, then no substitution occurs.
198 199 200 |
# File 'lib/logstash/event.rb', line 198 def sprintf(format) LogStash::StringInterpolation.evaluate(self, format) end |