In digital audio, the optimal level is always the same: 0dBFS (assuming that the system is designed and integrated correctly). If the highest peak reaches that level, noise and distortion are minimized. If you attempt to exceed that level, you have no choice but to re-record.
The problem is that you can't always be sure ahead of time what the maximum signal level will be. An audio signal has an average level, and also a peak level, which may be many dB higher than the average. Some kinds of signals (percussion, for instance) have very high peak-to-average ratios.
So, you have to guess what your peak level will be, and set your gain to allow enough headroom for the peak to stay at or below 0dBFS. On a very peaky signal, this might mean that your average levels are around -24dBFS, but that's OK. It takes some getting used to, especially if you're accustomed to the gentle saturation characteristics of analog tape.
The difficulty of accurately guessing the peak level in advance is why some people like to put a compressor between the preamp and the sound card. This can tame the peaks and make it easier to set the levels in the DAW. The downside is, you're stuck with the compression. Could be just the ticket, though, in a "live" situation where doing it over is not an option.
Hope that helps.