Summarize this article:

After you’ve kept your headache diary for several weeks or months, you should read through it and look for patterns. When reviewing it, you’ll likely notice that there are some common factors that precede the onset of your headaches. Pay special attention to things you eat or activities you engage in before you experience a headache. For example, you may notice that you get headaches after you’ve had a glass of wine or have been outside in the sun for several hours. Once you’ve reviewed your diary and identified patterns, try to avoid some of the factors that you think might be associated with your headache. Ultimately, avoiding triggers you’ve identified with your diary is the best way to prevent headaches. For example, if you’ve noticed that headaches follow your consumption of caffeine, stop drinking caffeine. Then continue using your diary for a few weeks and see if you have less headaches. When you have several weeks or months of diary entries, you should talk to your doctor about what you’ve found. Your doctor may be able to spot patterns or identify headache triggers that you’ve missed or dismissed.  Your doctor may be able to prescribe medication to reduce the severity of headaches. You should also have your vision checked to rule out vision problems as a cause of your headaches.
Look for patterns. Avoid items you suspect cause your headaches. Talk to your doctor.