Observing what Spotlight's mdworker is indexing for diagnostic purposes There has been a history of people reporting mdworker processes taking up lots of CPU time on older machines, but apart from vague suggestions to just re-create the entire Spotlight index, I could not find any diagnosis information.
My (modern) machine has no performance issues, I would just like to understand the reason for the &quot;Service exited due to SIGKILL&quot; messages that flood my system logs:
com.apple.xpc.launchd[1] (com.apple.mdworker.shared.00000000-0300-0000-0000-000000000000[6763]): Service exited due to SIGKILL | sent by mds[141]

Are there any logs I could use to find out what is actually going wrong; i.e. whether the indexing processes are stuck at a certain file? Is there a way to increase the messages' verbosity?
A bit of system information: This is happening on an iMac running Catalina (10.15.6), with just a few hundred GB of files. For testing purposes, I limited Spotlight categories (through System settings) to apps and contacts only, but that did not seem to make any difference. The machine has no directories where files might change constantly, no directories with excessive numbers of files and, as far as I know, no totally unusual file formats on it.
I’m not sure whether there’s a more detailed log generated by mdworker or mds themselves. You could use fs_usage to see what files they are reading though, run the following in Terminal:
sudo fs_usage mdworker mds

As it says in the man page: “The fs_usage utility presents an ongoing display of system call usage information pertaining to filesystem activity. It requires root privileges due to the kernel tracing facility it uses to operate. By default, the activity monitored includes all system processes except […]. These defaults can be overridden such that output is limited to include or exclude a list of processes specified by the user.”
Here’s a short sample of the output you'll get (I ran this in a narrow window, use a wider one to get the file paths in more detail):
11:07:49  fsgetpath         resourceLog.plist    0.000029   mds         
11:07:49  getattrlist       resourceLog.plist    0.000089   mds         
11:07:49  listxattr         resourceLog.plist    0.000042   mds         
11:07:49  getattrlist       resourceLog.plist    0.000164   mds         
11:07:49  getattrlist       resourceLog.plist    0.000029   mds         
11:07:54  exit                                   0.000118   mdworker    

The exit calls correspond to the messages “Service exited due to signal” in the “system.log”:
Aug  8 11:07:54 […] com.apple.xpc.launchd[1] (com.apple.mdworker.single.[…]):
  Service exited due to signal: Killed: 9 sent by mds[114]

For some more information on fs_usage, there’s an (old) article on ‘macobserver.com’ titled “Mac OS X: Using fs_usage as a Troubleshooting Tool”.