# Logstash ODX input File - unconventional input file

**URL:** <https://discuss.elastic.co/t/logstash-odx-input-file-unconventional-input-file/225324>\
**Category:** Logstash\
**Created:** [March 27, 2020, 2:57am UTC](https://discuss.elastic.co/t/logstash-odx-input-file-unconventional-input-file/225324 "2020-03-27T02:57:37Z")\
**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:** [March 27, 2020, 5:27pm UTC](https://discuss.elastic.co/t/logstash-odx-input-file-unconventional-input-file/225324/2 "2020-03-27T17:27:50Z")

</div>

The approach I would take would be to use a multiline codec on the input to read the file as a single event (as shown at the end of [this](https://discuss.elastic.co/t/parsing-xml-log-file-with-logstash/167306/2) post). Then use a ruby scan function

```
    ruby {
        code => '
            s = event.get("message")
            m = s.scan(/#([^\n]*)\n([^\n]*)?(\n|$)/)
            m.each { |x|
                event.set(x[0], x[1])
            }
        '
    }

```

That does not quite work because

```
#----- Start Task -----

#Location

```

results in '#----- Start Task -----\n#Location\n' rather than '#----- Start Task -----\n\n#Location\n' and thus you lose the Location field. However, it does process most of the fields correctly.

```
       "Cashier Counter" => "1",
        "Current Device" => "DigiMarkXP",
           "Taskcounter" => "1",
           "Customer ID" => "0118",
       "Customer Market" => "250",

```

etc. It is probably possible to gsub in the missing \n and recover the Location field.

Obviously this does not retain any of the task definition or other orchestration information.

---

_[View the full topic](https://discuss.elastic.co/t/logstash-odx-input-file-unconventional-input-file/225324)._
