Recording audio with gstreamer is easy:
gst-launch -e pulsesrc ! audioconvert ! \
lamemp3enc target=1 bitrate=64 cbr=true ! \
filesink location=audio.mp3
The pulsesrc element here refers to the pulseaudio input (pulseaudio is AFAIK the default sound system in all linux distributions nowadays). This is good and will capture audio from the default sound input, which can be microphone or line-in depending on the hardware and the pulseaudio configuration.
But what if I plug in my USB webcam with built-in microphone and I want to capture audio from that?