# Filebeat 7.1.0 Elasticsearch module audit pipeline incorrectly references @timestamp instead of timestamp

**URL:** <https://discuss.elastic.co/t/filebeat-7-1-0-elasticsearch-module-audit-pipeline-incorrectly-references-timestamp-instead-of-timestamp/182721>\
**Category:** Beats\
**Created:** [May 24, 2019, 7:50pm UTC](https://discuss.elastic.co/t/filebeat-7-1-0-elasticsearch-module-audit-pipeline-incorrectly-references-timestamp-instead-of-timestamp/182721 "2019-05-24T19:50:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Samo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_samo/32/46830_2.png) [@Chris\_Samo](https://discuss.elastic.co/u/Chris_Samo)\
**Post date:** [May 24, 2019, 7:50pm UTC](https://discuss.elastic.co/t/filebeat-7-1-0-elasticsearch-module-audit-pipeline-incorrectly-references-timestamp-instead-of-timestamp/182721/1 "2019-05-24T19:50:55Z")

</div>

I'm using Filebeat and Elasticsearch 7.1.0 to capture logs through the Docker input and parsing with the elasticsearch module with config such as:

```auto
filebeat.autodiscover:
  providers:
    # elasticsearch
    - type: docker
      labels.dedot: true
      templates:
        - condition:
            contains:
              docker.container.image: elasticsearch
          config:
            - module: elasticsearch
              audit:
                enabled: true
                input:
                  type: docker
                  containers.ids:
                    - "${data.docker.container.id}"
                  exclude_files: ['\.gz$']
                  containers.stream: stdout
                  include_lines: ['"type": "audit"']

```

This is successfully sending logs from my elasticsearch-based Docker services to my elasticsearch cluster, however I see the following error in all audit records:

```json
     "error": {
      "message": "field [@timestamp] not present as part of path [elasticsearch.audit.@timestamp]"
    }

```

Looking at the ingest pipeline installed into Elasticsearch by Filebeat (\_ingest/pipeline/filebeat-7.1.0-elasticsearch-audit-pipeline), I believe the problem is:

```json
{
  "date": {
    "field": "elasticsearch.audit.@timestamp",
    "target_field": "@timestamp",
    "formats": [
      "ISO8601"
    ],
    "ignore_failure": true
  }
},
{
  "remove": {
    "field": "elasticsearch.audit.@timestamp"
  }
},

```

Should instead match the similar lines from the server pipeline (\_ingest/pipeline/filebeat-7.1.0-elasticsearch-server-pipeline):

```json
{
  "date": {
    "field": "elasticsearch.server.timestamp",
    "target_field": "@timestamp",
    "formats": [
      "ISO8601"
    ],
    "ignore_failure": true
  }
},
{
  "remove": {
    "field": "elasticsearch.server.timestamp"
  }
},

```

This appears to be a problem in the [Filebeat elasticsearch audit pipeline definition](https://github.com/elastic/beats/blob/master/filebeat/module/elasticsearch/audit/ingest/pipeline.json#L35).

I think this may also be why I don't see a lot of the logs that have been processed by the elasticsearch module when using the default Filebeat-installed index template and pattern (there is no top-level "@timestamp" field defined for a lot of the documents, which prevents them showing up in the "filebeat-\*" queries because that field is specified as the time filter field).

N.B. deprecation and slowlog pipelines both appear to be correct (like server).

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [May 28, 2019, 7:46pm UTC](https://discuss.elastic.co/t/filebeat-7-1-0-elasticsearch-module-audit-pipeline-incorrectly-references-timestamp-instead-of-timestamp/182721/2 "2019-05-28T19:46:09Z")

</div>

Hi @Chris_Samo,

Welcome to the Elastic community forums and thanks for posting such a detailed description of this issue!

Interestingly, when Elasticsearch audit logging is turned on in a non-Docker environment, the audit log entries look like this:

```auto
{"@timestamp":"2019-05-28T12:33:31,246", "node.id":"qUZG15diSquz8jpvQbTmhA", "event.type":"rest", "event.action":"anonymous_access_denied", "origin.type":"rest", "origin.address":"[::1]:49499", "url.path":"/", "request.method":"GET", "request.id":"b5A_F-ihQaOHrxBgAa3gjA"}

```

Note the name of the timestamp field here: it is `@timestamp`, not `timestamp`. That's why the Filebeat ingest pipeline is currently looking for `@timestamp`.

Of course, for deprecation, server, and slow logs, the timestamp field is named `timestamp` in Docker and non-Docker contexts so the Filebeat ingest pipelines work in those cases.

I'm looking into the naming inconsistency for the audit log's timestamp field and will post an update here.

Thanks,

Shaunak

---

<div class="post-metadata">

**Author:** ![Chris\_Samo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chris_samo/32/46830_2.png) [@Chris\_Samo](https://discuss.elastic.co/u/Chris_Samo)\
**Post date:** [May 28, 2019, 8:10pm UTC](https://discuss.elastic.co/t/filebeat-7-1-0-elasticsearch-module-audit-pipeline-incorrectly-references-timestamp-instead-of-timestamp/182721/3 "2019-05-28T20:10:56Z")

</div>

@shaunak thanks for the quick reply, I'll keep an eye on future updates to the Dockerised version of Filebeat for any changes (and continue to use my workaround for the time being while we figure out the best way to index and visualise the data).

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [May 29, 2019, 11:01am UTC](https://discuss.elastic.co/t/filebeat-7-1-0-elasticsearch-module-audit-pipeline-incorrectly-references-timestamp-instead-of-timestamp/182721/4 "2019-05-29T11:01:16Z")

</div>

Small update: after discussing this with Elasticsearch developers, we've created two GitHub issues to track a short-term fix in Filebeat and a longer-term fix in Elasticsearch:

- Short-term fix: [https://github.com/elastic/beats/issues/12339](https://github.com/elastic/beats/issues/12339)
- Longer-term fix: [https://github.com/elastic/elasticsearch/issues/42666](https://github.com/elastic/elasticsearch/issues/42666)

If you have an account on GitHub you may want to subscribe to these issues and receive updates on their progress.

Thanks,

Shaunak

---

<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:** [June 26, 2019, 1:01pm UTC](https://discuss.elastic.co/t/filebeat-7-1-0-elasticsearch-module-audit-pipeline-incorrectly-references-timestamp-instead-of-timestamp/182721/5 "2019-06-26T13:01:18Z")

</div>

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