I need to record some audio for a very long time (possibly several weeks). Why you ask? a slight (incessant) next-door dog problem which I need to collect data for. I am looking for a lightweight recording program that can stream directly to a usb flash disk in a compressed format. Hopefully it would be light enough to run on a raspberrypi. Given the flash drive would be only 8GB it needs to run a very good compression in real time. It would also need to be open source (or free software). Can anyone please recommend any software that can do this? If there are no lightweight programs available I will be able to scale up. Would the likes of Ardour be able to handle this kind of recording?
Based on your needs, you are looking at the problem wrong. You do not want something that can record several weeks of audio. You want something that can trigger a recording of time-coded audio for a period after a threshold level is reached. This way you don't have to record hours of silence, but can record when and how the dog is barking (or other loud noises are occurring.)
Personally, I typically use a Zoom H4n for this kind of thing, but you might be able to duplicate it by having a macro program that can monitor the audio input and trigger a recording when a certain level is exceeded. Possibly have it stop a certain number of minutes after that level is last exceeded. This would probably take some manual development work, but would be cheaper than buying something like an H4n. A simple voice recorder might also be able to do it for less though.