What the correct way to use dynamic object

Why do you need to have the entire log file as a single event? What are you trying to achieve?

The usual way to index log files is to do so line by line as separate documents. If there are lines that belong together, these can be grouped together as a single event through multiline processing.