How to stop Time Machine backing up log files inside application containers?
I had a similar need and using a combination of this answer and this answer I came up with the following solution.

Create a property list (e.g. ~/Library/LaunchAgents/excludeLogFiles.plist) which will be loaded with launchctl load ~/Library/LaunchAgents/excludeLogFiles.plist:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;Label&lt;/key&gt;
  &lt;string&gt;excludeLogFiles&lt;/string&gt;
  &lt;key&gt;ProgramArguments&lt;/key&gt;
  &lt;array&gt;
    &lt;string&gt;/bin/zsh&lt;/string&gt;
    &lt;string&gt;-c&lt;/string&gt;
    &lt;string&gt;tmutil addexclusion /Users/user/Library/Containers/**/Data/Library/Logs&lt;/string&gt;
  &lt;/array&gt;
  &lt;key&gt;WatchPaths&lt;/key&gt;
  &lt;array&gt;
    &lt;string&gt;/Users/user/Library/Containers&lt;/string&gt;
  &lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;


Instead of using EnableGlobbing, which hasn't been supported since OS X 10.10 (ref), the path gets expanded by the program calling /bin/zsh &lt;args&gt;.

A couple of things I found while experimenting:


The ** glob works with zsh but not bash
Using ~ should work in the path for ProgramArguments but I don't know if the same trick can be used for WatchPath. Hard-coding the user path might be necessary.