It's most likely an ear mite, given that your dog has suffered from them before. Continue the medication until its conclusion; if there's still a bug after the drug therapy has concluded, take your dog to see the veterinarian.
Earmites look like tiny black dots. A larger bug is most likely a flea or a tick, both of which are worse then mites. See your vet immediately if different.