For the ISS, the relevant bit of kit would be the Trace Contaminant Control System, which is part of the Air Revitalisation System.
A Trace Contaminant Control System ensures that over 200 various trace chemical contaminants generated from material off-gassing and crew metabolic functions remain within allowable limits. A mass spectrometer measures the oxygen, nitrogen, hydrogen, carbon dioxide, methane and water vapour content of the cabin atmosphere.
It has a bunch of filters which need to be replaced periodically, and a hot catalytic cell to break down the offending gasses.
(diagram from this presentation, which in turn took it from Designing for Human Presence in Space published in 1994, so you can see this stuff isn't exactly super modern cutting edge gear)
Useful document: SS ECLSS Technology Evolution for Exploration, which covers the ISS environmental control systems in general, but has some relevant things to say about ths stuff you care about:
The ISS Trace Contaminant Control System (TCCS) consists of an activated charcoal adsorption bed and thermal catalytic oxidizer with post-sorbent bed. The system is simple, provides broad spectrum contaminant control, and has encountered no significant on-orbit problems. The activated carbon bed is an expendable which requires routine replacement (projected to be 2.25 years based on crew ISS contaminant loads)', and the current catalyst must be protected from poisoning.
Another component is the Major Constituent Analyzer which is a mass spectrometer which monitors levels of various things, including H2 and CH4.
The chief atmosphere monitor on ISS is the Major Constituent Analyzer (MCA) which is based on mass spectrometry. While it has exhibited a stable, repeatable performance for analyzing N2, O2, CO2, CH4, H2, and H20, it has a number of drawbacks. It has a fairly complex control system, requires a roughing vacuum resource for startup, and the ion pump has a limited life. Its assay is limited to the six analytes listed above.
(cut'n'paste from the linked PDF had some weird issues, so if you spot any mangled stuff in the quotes above, the original source might make more sense)
Quite what other spacecraft do, or did, isn't so clear. I found an abstract for a conference paper, Analysis and composition of a model trace gaseous mixture for a spacecraft from 1986 which seems to predate active removal of problematic volatiles:
Growing concern over trace gaseous contaminant accumulations in the enclosed atmospheres of long duration spacecraft missions has prompted the development of a trace contaminant data base on the basis of gas, lithium hydroxide, and charcoal samples collected on Space Shuttle missions.
It is possible that spacecraft only intended for short-term operation just use activated carbon filters, perhaps assisted by the crew having a sensible diet.