What you want to do is to convert your log string into tokens. You have to create a dictionary that translates strings/string parts into tokens and the sender and receiver must have this dictionary. When you send your string, define a single escape character that is followed by a token and make sure that this escape code is nowhere else in your normal log strings.
In the sender, you must scan your strings before sending for string parts that are in your dictionary and then just send the escape code and the token. Everything else that is not found in your dictionary is transferred normally.
On the receiver side, your can simply decode this using the same dictionary.
By the way: this is the way a (very simple) compressor works. You also can use an LZW compressor algorithm, which maybe has even better results (but be sure not to clear the translation tables after each transmission!).