# Use first line of file for field names

**URL:** <https://discuss.elastic.co/t/use-first-line-of-file-for-field-names/78171>\
**Category:** Logstash\
**Created:** [March 10, 2017, 4:47pm UTC](https://discuss.elastic.co/t/use-first-line-of-file-for-field-names/78171 "2017-03-10T16:47:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andre22](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@andre22](https://discuss.elastic.co/u/andre22)\
**Post date:** [March 10, 2017, 4:47pm UTC](https://discuss.elastic.co/t/use-first-line-of-file-for-field-names/78171/1 "2017-03-10T16:47:00Z")

</div>

Hi,

importing log files to analyze I realise that they have slightly differences in their structure, so i would have to create lots of patterns and conditions to match them all. But the files have a first line like this: "#Fields: date time ip username host" which is matched by the following files (except the "#Fields").

Is there a way to automatically set the field names based on the first line (header)?

thank you!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 7, 2017, 4:47pm UTC](https://discuss.elastic.co/t/use-first-line-of-file-for-field-names/78171/2 "2017-04-07T16:47:04Z")

</div>

Closed on April 7, 2017, 4:47pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
