# How to parse Logline

**URL:** <https://discuss.elastic.co/t/how-to-parse-logline/87736>\
**Category:** Logstash\
**Created:** [May 31, 2017, 12:17pm UTC](https://discuss.elastic.co/t/how-to-parse-logline/87736 "2017-05-31T12:17:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hispeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hispeed/32/16232_2.png) [@hispeed](https://discuss.elastic.co/u/hispeed)\
**Post date:** [May 31, 2017, 12:17pm UTC](https://discuss.elastic.co/t/how-to-parse-logline/87736/1 "2017-05-31T12:17:05Z")

</div>

Hi,

I have the following line which I recieve in Kibana successfully.

`Connection ArchivUser:	CIFS client [ArchivUser] from [192.168.0.15(IP:192.168.0.15)] accessed the shared folder [Archiv Filme].`

So: "Connection" I want to add in a new field called: "Synology\_Verb\_Typ". "ArchivUser" is the Username and so this should be in a field called: Username or User.

I'm still new to the whole elasticsearch stack. So my question how can I now parse this log line? Can someone give an example only for the two fields, then it should be possible for me to get the whole line done.

---

<div class="post-metadata">

**Author:** ![pts0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pts0/32/17811_2.png) [@pts0](https://discuss.elastic.co/u/pts0)\
**Post date:** [May 31, 2017, 12:41pm UTC](https://discuss.elastic.co/t/how-to-parse-logline/87736/2 "2017-05-31T12:41:22Z")

</div>

Have a look at [https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html)

---

<div class="post-metadata">

**Author:** ![hispeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hispeed/32/16232_2.png) [@hispeed](https://discuss.elastic.co/u/hispeed)\
**Post date:** [May 31, 2017, 7:05pm UTC](https://discuss.elastic.co/t/how-to-parse-logline/87736/3 "2017-05-31T19:05:14Z")

</div>

I tried with the following code, but nothing usful happens:

```
filter {

    if [logsource] == "XXXXXXserver" {
        grok {
                 match => { "message" => "%{WORD:Synology_Verb_Typ} %{SPACE} %{USERNAME:Syno_User} %{GREEDYDATA}" }
        }

        kv {
                value_split => ":"
                field_split => ","
        }
   }
    if [logsource] == "XXXXXX_SERVER" {

        kv {
                value_split => ":"
                field_split => ","
        }
   }
}

```

Attached you can vie the output in Kibana.

 ![](https://us1.discourse-cdn.com/elastic/original/3X/7/9/79df90cf8382db1e206a87929611a6a6d342e680.png)

---

<div class="post-metadata">

**Author:** ![pts0](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pts0/32/17811_2.png) [@pts0](https://discuss.elastic.co/u/pts0)\
**Post date:** [May 31, 2017, 9:44pm UTC](https://discuss.elastic.co/t/how-to-parse-logline/87736/4 "2017-05-31T21:44:59Z")

</div>

I suppose problem is that you have a space and `%{SPACE}` in you expression, that result in failing parsing. Did you get `_grokparsefailure` ?

try

```
grok {
                 match => { "message" => "%{WORD:Synology_Verb_Typ}%{SPACE}\[%{USERNAME:Syno_User}\] %{GREEDYDATA}" }
        }
```

---

<div class="post-metadata">

**Author:** ![hispeed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hispeed/32/16232_2.png) [@hispeed](https://discuss.elastic.co/u/hispeed)\
**Post date:** [June 7, 2017, 7:37am UTC](https://discuss.elastic.co/t/how-to-parse-logline/87736/5 "2017-06-07T07:37:08Z")

</div>

Hi, i have added your line but I think i got a different problem.  
Because right now I won't add my Tag. So I think it is not going thru the filter. How can i check that?

```
filter {

    if [logsource] == "XXXXerver" {
        grok {
                 match => { "message" => "%{WORD:Synology_Verb_Typ}%\[%{USERNAME:Syno_User}\] %{GREEDYDATA}" }
        add_tag => ["Synology%{host}"]
        }

        kv {
                value_split => ":"
                field_split => ","
        }
   }
    if [logsource] == "XXXXStation" {

        kv {
                value_split => ":"
                field_split => ","
        }
   }
}
```

---

<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:** [July 5, 2017, 7:37am UTC](https://discuss.elastic.co/t/how-to-parse-logline/87736/6 "2017-07-05T07:37:40Z")

</div>

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