Try this: simply put 1-2 red chillies in the container. I put red chillies in all the containers in my kitchen which contain not just various types of dal, but also for those in which I store flour. In the case of dals, I pop in the chillies directly in them. In the case of a flour, I put the flour in its original packet and outside it, within the container, I put the chillies. I have found it to be effective so hope it works out for you too.
I would also suggest that you not hoard dals or other types of grains in large quantities. If it is a small family, there is no sense in storing 1 to 5kgs of grains!! You can buy half a kg and only when the quantity is down to a low level buy again more. In some cases, even quarter kg is enough. For example, urad dal may not be used often, maybe just once in while to put with tadka for a vegetable. By buying less, if at all there is the possibility of having to throw away something due to excessive bugs & it being impossible to clean it up, at least you will not have wasted huge quantities.
When you make a commitment, you create hope. When you keep a commitment you create trust! ~ John C. Maxwell