# Logs are not getting parsed?

**URL:** https://discuss.elastic.co/t/logs-are-not-getting-parsed/69355
**Category:** Beats
**Tags:** filebeat
**Created:** [December 18, 2016, 7:51am UTC](https://discuss.elastic.co/t/logs-are-not-getting-parsed/69355 "2016-12-18T07:51:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![sohimankotia](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@sohimankotia](https://discuss.elastic.co/u/sohimankotia)
#### Post date: [December 18, 2016, 7:51am UTC](https://discuss.elastic.co/t/logs-are-not-getting-parsed/69355/1 "2016-12-18T07:51:03Z")

</div>

Hi ,

I have log file containing logs in format

127.0.0.1 - - [16/Dec/2016:17:38:39 +0530] "GET /feed/user/785400761?q.l.m=en&debug=enabled HTTP/1.1" 200 - "-" "Jersey/2.25 (HttpUrlConnection 1.8.0\_111)" 1041

But In elastic search this line is not getting parsed and saved as single line with key "message ".

How can I pre process this log line with fields and values in file beat .

```
{
  "_index": "filebeat-2016.12.18",
  "_type": "apache",
  "_id": "AVkOPcVbK0-PQC85yaJh",
  "_score": null,
  "_source": {
    "@timestamp": "2016-12-17T19:24:06.361Z",
    "beat": {
      "hostname": "VER-BLR-LT1599",
      "name": "VER-BLR-LT1599",
      "version": "5.1.1"
    },
    "input_type": "log",
    "message": "212.87.37.154 - - [12/Sep/2016:16:21:15 +0000] \"GET /favicon.ico HTTP/1.1\" 200 3638 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36\"",
    "offset": 212,
    "source": "/home/sohanvir/Desktop/code-env/web/prod/test/ex.log",
    "type": "apache"
  },
  "fields": {
    "@timestamp": [
      1482002646361
    ]
  },
  "sort": [
    1482002646361
  ]
}

```

Thanks In Advance

---

<div class="post-metadata">

### Author: ![RdrgPorto](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rdrgporto/32/13278_2.png) [@RdrgPorto](https://discuss.elastic.co/u/RdrgPorto)
#### Post date: [December 18, 2016, 12:12pm UTC](https://discuss.elastic.co/t/logs-are-not-getting-parsed/69355/2 "2016-12-18T12:12:59Z")

</div>

Hi,

You have to use **Grok** , that is, you can use **Logstash** in order to parse this message in different fields. With **Filebeat** , you can send logs to **Logstash** directly or **Redis**.

You can take a look in the documentation about **Grok:** [Link](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html).

Moreover, in your case, it is very simple, it seems an _Apache log_, in the filter section you could write:

```
filter {
  grok {
    match => { "message" => "%{COMMONAPACHELOG}" }
   }
} 

```

Regards

---

<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: [January 15, 2017, 12:13pm UTC](https://discuss.elastic.co/t/logs-are-not-getting-parsed/69355/3 "2017-01-15T12:13:04Z")

</div>

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