MIDI and Audio
To accomplish this you need an Audio interface as well as a MIDI interface. Many audio interfaces also have a MIDI input (I have a MOTU Ultralite and mine has audio and MIDI and hooks to my Mac with Firewire) so that they function as both.
If you have this, you simply plug the audio and MIDI outputs of your external keyboard into the audio and MIDI inputs of your computer interface. If the drivers of the interface are installed properly Logic will not only hear the audio from the keyboard so that it can record it as an audio file, but it will 'record' the MIDI (or performance) data from the MIDI output so that you can make changes, transpose, and perform all sorts of other editing on your musical passages.