Easy to use – Maintain the quality of web appearance: Track the number of html 404 responses to correct missing pages

Probably this was discussed many times, but I do not know the technical term to look for it.

Situation:
Suppose there are many external links pointing to pages in a given A domain (for example, links in blogs or forums that point to documentation and guides for a software product). Over time, some of the content and pages within domain A fade, change their name or move, but external links to those contents still remain.

Now users who click on those external links will get a 404 error and in their subconscious they will associate something bad with domain A and the products they are selling 🙂

What would be the common way in which the domain administrator registers the number of 404 calls and the "routes" requested (ie, the particular page that the user requested), for example, if all the sites are hosted on a web server? Apache?

With this information, it would be easy to maintain the quality of a web appearance that will improve the user experience and probably also the rankings in the search engines.
Thank you!