# Splitt Message after Hostname

**URL:** <https://discuss.elastic.co/t/splitt-message-after-hostname/116977>\
**Category:** Logstash\
**Created:** [January 25, 2018, 6:47am UTC](https://discuss.elastic.co/t/splitt-message-after-hostname/116977 "2018-01-25T06:47:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![A.Klos](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@A.Klos](https://discuss.elastic.co/u/A.Klos)\
**Post date:** [January 25, 2018, 6:47am UTC](https://discuss.elastic.co/t/splitt-message-after-hostname/116977/1 "2018-01-25T06:47:24Z")

</div>

Hi,

I have following line:

message: \<30\>Jan 24 13:59:45 10.243.x.x named[10148]: queries: client 10.243.x.x#47205 (88.255.x.x.in-addr.arpa): query: 88.255.x.x.in-addr.arpa IN PTR + (10.243.x.x)

I allready split it and have to split a second line:

syslog-message: queries: client 10.243.x.x#47205 (88.255.x.x.in-addr.arpa): query: 88.255.x.x.in-addr.arpa IN PTR + (10.243.x.x)

I'm using following grok

queries: client %{IP:dns\_client\_ip}#%{NUMBER:dns\_client\_key} (%{WORD:hostname}.%{WORD:domain1}.%{WORD:domain2}

Content in () could be:

- ip Adress : 10.10.x.x
- Hostname with special character: \_nfsdomain.my.dom
- Hostname with no specialcarakter: myhost.my.dom

How could I define content betwen ( ) as one word ?

Regards

---

<div class="post-metadata">

**Author:** ![Krunal\_kalaria](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krunal_kalaria/32/23862_2.png) [@Krunal\_kalaria](https://discuss.elastic.co/u/Krunal_kalaria)\
**Post date:** [January 25, 2018, 7:24am UTC](https://discuss.elastic.co/t/splitt-message-after-hostname/116977/2 "2018-01-25T07:24:05Z")

</div>

Hi @A.Klos  
in grok you can use NOTSPACE try this it may work.

Thnks.

Krunal k.

---

<div class="post-metadata">

**Author:** ![A.Klos](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@A.Klos](https://discuss.elastic.co/u/A.Klos)\
**Post date:** [January 25, 2018, 11:51am UTC](https://discuss.elastic.co/t/splitt-message-after-hostname/116977/3 "2018-01-25T11:51:34Z")

</div>

Thank you,

now I have following Pattern:

queries: client %{IP:dns\_client\_ip}#%{NUMBER:dns\_client\_key} (%{NOTSPACE:Hostname})

Hostname looks: \_nfsv4idmapdomain.XX.XX):

Only last thing is remove ): at the end.

I think with gsub?

mutate {  
gsub =\> ["message",")", ""]  
}

---

<div class="post-metadata">

**Author:** ![A.Klos](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@A.Klos](https://discuss.elastic.co/u/A.Klos)\
**Post date:** [January 26, 2018, 1:28pm UTC](https://discuss.elastic.co/t/splitt-message-after-hostname/116977/4 "2018-01-26T13:28:02Z")

</div>

Hi,

I solved problem:

filter {  
if [type] == "syslog-infoblox" {  
grok {  
match =\> ["message", "%{SYSLOG5424PRI}%{SYSLOGTIMESTAMP:syslog\_timestamp} %{HOSTNAME:syslog\_hostname} %{DATA:syslog\_program}(?:[%{POSINT:syslog\_pid}])?: %{GREEDYDATA:syslog\_message}"]  
add\_field =\> ["received\_at", "%{@timestamp}"]  
add\_field =\> ["received\_from", "%{host}"]  
}  
grok {  
match =\>  
["syslog\_message","queries: client %{IP:source}#%{NUMBER:dns\_client\_key} (%{NOTSPACE:target\_work}"]  
}  
grok {  
match =\>  
["target\_work","%{URIHOST:target}):"]  
remove\_field =\> ["target\_work"]  
remove\_field =\> ["dns\_client\_key"]  
remove\_field =\> ["dns\_client\_key"]  
}  
}  
date {  
match =\> ["syslog\_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss"]

```
    }

```

}

Field is now: target.

Regards

---

<div class="post-metadata">

**Author:** ![Krunal\_kalaria](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krunal_kalaria/32/23862_2.png) [@Krunal\_kalaria](https://discuss.elastic.co/u/Krunal_kalaria)\
**Post date:** [January 29, 2018, 5:16am UTC](https://discuss.elastic.co/t/splitt-message-after-hostname/116977/5 "2018-01-29T05:16:29Z")

</div>

great 🙂

---

<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:** [February 26, 2018, 5:16am UTC](https://discuss.elastic.co/t/splitt-message-after-hostname/116977/6 "2018-02-26T05:16:33Z")

</div>

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