# Differentiate between sections within a single log file

**URL:** https://discuss.elastic.co/t/differentiate-between-sections-within-a-single-log-file/168478
**Category:** Logstash
**Created:** [February 14, 2019, 7:30pm UTC](https://discuss.elastic.co/t/differentiate-between-sections-within-a-single-log-file/168478 "2019-02-14T19:30:10Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [February 14, 2019, 8:21pm UTC](https://discuss.elastic.co/t/differentiate-between-sections-within-a-single-log-file/168478/2 "2019-02-14T20:21:32Z")

</div>

I would do something very similar to the solution I [proposed](https://discuss.elastic.co/t/parse-log-file-with-two-formats-in-it/166876/2?u=badger) for the other format you had...

```
    if [message] =~ /^(\s*$|:::::)/ {
            drop {}
    } else if [message] =~ /^TIME/ {
            # parse it and stash it in a ruby class variable
    } else if [message] =~ " .* .* " {
            csv {separator => " " autodetect_column_names => true }
            # and append the metadata
    } else {
            drop {}
    }
```

---

_[View the full topic](https://discuss.elastic.co/t/differentiate-between-sections-within-a-single-log-file/168478)._
