# Parsing apache access log file and extract timestamp

**URL:** <https://discuss.elastic.co/t/parsing-apache-access-log-file-and-extract-timestamp/162016>\
**Category:** Logstash\
**Created:** [December 24, 2018, 5:05pm UTC](https://discuss.elastic.co/t/parsing-apache-access-log-file-and-extract-timestamp/162016 "2018-12-24T17:05:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eliot54](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@Eliot54](https://discuss.elastic.co/u/Eliot54)\
**Post date:** [December 24, 2018, 5:05pm UTC](https://discuss.elastic.co/t/parsing-apache-access-log-file-and-extract-timestamp/162016/1 "2018-12-24T17:05:04Z")

</div>

I'm trying to use a custom log file with the following format in ELK :

```
109.70.81.5 - - [01/Jul/1995:00:00:01 -0400] "GET /history/apollo/ HTTP/1.0" 200 6245

```

However logstash /kibana keeps using my localhosts timestamp instead of the one from the log file. Here is my config file :

```
filter {
  if [type] == "apache-common" {
grok {
  match => { "message" => "%{COMMONAPACHELOG}" }
}
date {
  match => ["timestamp", "dd/MMM/yyyy:HH:mm:ss -SSSS"]
  target => "timestamp"
  add_field => { "debug" => "timestampMatched"}
}
  }
}

```

And the JSON result file is the following :

```
{
  "_index": "sdata",
  "_type": "doc",
  "_id": "g4Tu4GcB2Kx_V5iannxt",
  "_version": 1,
  "_score": null,
  "_source": {
    "message": "UNKNOWN_HOST - - [01/Jul/1995:04:11:55 -0400] \"GET /history/apollo/images/footprint-small.gif HTTP/1.0\" 200 0",
    "tags": [
      "_grokparsefailure"
    ],
    "type": "apache-common",
    "@timestamp": "2018-12-24T15:55:26.252Z",
    "@version": "1",
    "host": "userver",
    "path": "/home/user/data/access"
  },
  "fields": {
    "@timestamp": [
      "2018-12-24T15:55:26.252Z"
    ]
  },
  "sort": [
    1545666926252
  ]
}
```

---

<div class="post-metadata">

**Author:** ![AquaX](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aquax/32/92006_2.png) [@AquaX](https://discuss.elastic.co/u/AquaX)\
**Post date:** [January 3, 2019, 3:30pm UTC](https://discuss.elastic.co/t/parsing-apache-access-log-file-and-extract-timestamp/162016/2 "2019-01-03T15:30:01Z")

</div>

> [@Eliot54](#):
>
> target =\> "timestamp"

Either remove this line or change it to:

`target => "@timestamp"`

> **[Date filter plugin | Logstash Reference \[8.11\] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html#plugins-filters-date-target)**

---

<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 31, 2019, 3:30pm UTC](https://discuss.elastic.co/t/parsing-apache-access-log-file-and-extract-timestamp/162016/3 "2019-01-31T15:30:08Z")

</div>

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