Check any filters in the vacuum are clean and replace if needed.
Clean any hoses and attachments. Any parts which are removable place in a sink of soap and water if they need cleaning. If you hose has a power line in them do not soak them.
Clear the fibers and hairs from the vacuum roller head regularly
Place a sheet of fabric softener sheet in the bag of your vacuum, put a couple of drops of essential oil onto a tissue and place in vacuum bag. As carpet deodorizer which you sprinkle on the carpet can ruin your motor, plus do you want to inhale the powder freshener once its been through your vacuum?
If you have carpet and pets this could be causing the odor. Shampoo your carpets every three months because the fur from pets can make you vacuum smell.
Check that nothing is stuck in the hose.
If there is a burning smell, you may need to change the belt(s).
Don’t run your vacuum on any surface that isn’t completely dry.