We found this foam exuding from from the base of a beech after November rain. The most likely explanation seems to be that it’s case of bacterial wetwood (also known as slime flux).
We read here that slime flux occurs when microorganisms (fungi and bacteria) invade cracks, wounds, or cavities and begin to ferment sap and dead wood. Ethanol and gases are produced during the fermentation process, which cause pressure to build. Excess pressure is relieved when liquid and gas is expelled through the surface. It seems everybody enjoys a free beer and it attracts insects such as bees, wasps, ants, butterflies, and moths though there aren’t many of these around in late autumn. The fluids darken when exposed to air and may be produced so excessively as to flow or pool on the ground below. Various fungi and bacteria colonise the fluids once exposed to oxygen, and therefore the ooze may become slimy and bad smelling.