Probably the most straight-forward way to do this is to use a regular expression. It's quite easy to translate such a substring expression to regex. In order to see the altered message, you have to change the content of the _raw field.
eg.
substring(message, charindex(message, "foo"), 20)
would be translated as
sourcetype=mysourcetype | rex "(?<_raw>foo.{17})"
You can as well use the eval command to extract substrings, but there's no charindex equivalent available:
sourcetype=mysourcetype | eval _raw=substr(_raw, 5, 25)
... View more