# Splitting greedydata

**URL:** https://discuss.elastic.co/t/splitting-greedydata/78408
**Category:** Logstash
**Created:** [March 13, 2017, 7:44pm UTC](https://discuss.elastic.co/t/splitting-greedydata/78408 "2017-03-13T19:44:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Alex\_Mendez](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@Alex\_Mendez](https://discuss.elastic.co/u/Alex_Mendez)
#### Post date: [March 13, 2017, 7:44pm UTC](https://discuss.elastic.co/t/splitting-greedydata/78408/1 "2017-03-13T19:44:07Z")

</div>

Greetings, I'd like to know if its possible to split the message in GREEDYDATA further into searchable data.

Example

line in log stash  
grok {  
match =\> ["message", "%{SYSLOGTIMESTAMP:syslog\_timestamp} %{HOSTNAME} %{PROG:program}(?:[%{POSINT:pid}])? %{GREEDYDATA:msgsplit}"]

logstash output

logstash[17194]: "msgsplit" =\> " Did not receive identification string from ",

logstash[17194]: "msgsplit" =\> " pam\_unix(sshd:session): session opened for user tester by (uid=0)",

Can i take GREEDYDATA,"msgsplit" and further break that down? If so , any guidance on the best way to approach this?

---

<div class="post-metadata">

### Author: ![rayl7786](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@rayl7786](https://discuss.elastic.co/u/rayl7786)
#### Post date: [March 13, 2017, 8:36pm UTC](https://discuss.elastic.co/t/splitting-greedydata/78408/2 "2017-03-13T20:36:56Z")

</div>

I did something similar,

grok {  
match =\> { "message" =\> "%{SYSLOGTIMESTAMP:date} %{IPORHOST:hostname} %{GREEDYDATA:msg}" }  
}  
mutate {  
replace =\> ["message", "%{msg}"]  
}  
mutate {  
remove\_field =\> ["msg"]  
}  
grok {  
match =\> { "message" =\> "" }  
}

Not sure if this is what you are looking for.

---

<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: [March 14, 2017, 6:25am UTC](https://discuss.elastic.co/t/splitting-greedydata/78408/3 "2017-03-14T06:25:42Z")

</div>

> grok {  
> match =\> { "message" =\> "%{SYSLOGTIMESTAMP:date} %{IPORHOST:hostname} %{GREEDYDATA:msg}" }  
> }  
> mutate {  
> replace =\> ["message", "%{msg}"]  
> }  
> mutate {  
> remove\_field =\> ["msg"]  
> }

Shorter:

```plaintext
grok {
  match => { "message" => "%{SYSLOGTIMESTAMP:date} %{IPORHOST:hostname} %{GREEDYDATA:msg}" }
  overwrite => ["message"]
}

```

> grok {  
> match =\> { "message" =\> "" }  
> }

What's this supposed to mean?

---

<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: [March 14, 2017, 6:27am UTC](https://discuss.elastic.co/t/splitting-greedydata/78408/4 "2017-03-14T06:27:10Z")

</div>

> Can i take GREEDYDATA,"msgsplit" and further break that down? If so , any guidance on the best way to approach this?

You can apply another grok filter to your `msgsplit` field. Or, don't use GREEDYDATA in the first place; just use a more specific pattern.

---

<div class="post-metadata">

### Author: ![rayl7786](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@rayl7786](https://discuss.elastic.co/u/rayl7786)
#### Post date: [March 14, 2017, 12:17pm UTC](https://discuss.elastic.co/t/splitting-greedydata/78408/5 "2017-03-14T12:17:16Z")

</div>

Sorry, I should have stated something in between the "". I just left it blank to show what I did. Thank you for the shorter way. I will implement this in my filters.

In yours, the 'overwrite =\> ["message"]' should show the field name you used for Greedydata, correct?

---

<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: [March 14, 2017, 12:30pm UTC](https://discuss.elastic.co/t/splitting-greedydata/78408/6 "2017-03-14T12:30:14Z")

</div>

> In yours, the 'overwrite =\> ["message"]' should show the field name you used for Greedydata, correct?

Yes.

---

<div class="post-metadata">

### Author: ![Alex\_Mendez](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@Alex\_Mendez](https://discuss.elastic.co/u/Alex_Mendez)
#### Post date: [April 5, 2017, 6:18pm UTC](https://discuss.elastic.co/t/splitting-greedydata/78408/7 "2017-04-05T18:18:28Z")

</div>

thanks i ended up creating a more specific pattern

---

<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: [May 3, 2017, 6:18pm UTC](https://discuss.elastic.co/t/splitting-greedydata/78408/8 "2017-05-03T18:18:36Z")

</div>

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