logrewrite: fix rewrite set/subst related segfault

If a set/rewrite operation is referenced from multiple locations, and
it uses template functions, a segfault has occurred, as the clone
operation didn't properly propagate the associated configuration object,
which rendered template->cfg to be NULL, which in turn caused
template-function lookup code to dereference a NULL pointer.

This was fixed by two dependent changes:
  - always passing the already-compiled LogTemplate to the rewrite
    operations instead of a string constant.
  - reusing the compiled template object in clone()

Since LogTemplate is reused, and the first one contains a proper reference
to the appropriate configuration object, the NULL deref issue was
solved too.

Reported-By: Johnson, Chris <chris.johnson3@hp.com>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>