Keeping values across events

How can I store a date and assign it to upcoming events? Also I want to update the variable to new date when I find a new one.

What problem are you trying to solve here?

I have a log file which has dates in just few lines. So, the same date
should be included as a field in the following lines when parsed, until I
get a new date. When a new date is encountered it should be used for the
following events. So basically I need to store the information obtained
from one line across next few lines.

Do these lines need to be treated as individual events?

Yes. It should be separate events.