# Parsing a variable length log

**URL:** <https://discuss.elastic.co/t/parsing-a-variable-length-log/74436>\
**Category:** Logstash\
**Created:** [February 8, 2017, 9:51pm UTC](https://discuss.elastic.co/t/parsing-a-variable-length-log/74436 "2017-02-08T21:51:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcnovy](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@mcnovy](https://discuss.elastic.co/u/mcnovy)\
**Post date:** [February 8, 2017, 9:51pm UTC](https://discuss.elastic.co/t/parsing-a-variable-length-log/74436/1 "2017-02-08T21:51:54Z")

</div>

Hi,

Sorry is this if too obvious, but I feel like I have been browsing through all of google now 🙂

I have a log, where I can't seem to figure out any patterns.

I need the location from that line, but the message can differ quite alot.  
example.

```auto
NEW YORK APG2 - MLK
NEW YORK APG1 - MLK
NEW YORK APG2
Pittsburgh APG2 - MLK
Pittsburgh PSDS1
Pittsburgh

```

Well, I only need the location name, and not the APG og MLK etc.

Can anyone help please. thanks

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 9, 2017, 6:58am UTC](https://discuss.elastic.co/t/parsing-a-variable-length-log/74436/2 "2017-02-09T06:58:16Z")

</div>

This is trivial with a grok filter if you can define the unique characteristics of the APG/MLK strings. For example, are they always uppercase and digits? And no place names end in that way?

---

<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:** [March 9, 2017, 6:58am UTC](https://discuss.elastic.co/t/parsing-a-variable-length-log/74436/3 "2017-03-09T06:58:30Z")

</div>

Closed on March 9, 2017, 6:58am UTC

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