# Auditbeat update document\_id

**URL:** <https://discuss.elastic.co/t/auditbeat-update-document-id/291902>\
**Category:** Beats\
**Tags:** auditbeat\
**Created:** [December 15, 2021, 6:18am UTC](https://discuss.elastic.co/t/auditbeat-update-document-id/291902 "2021-12-15T06:18:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cva/32/85514_2.png) [@cva](https://discuss.elastic.co/u/cva)\
**Post date:** [December 15, 2021, 6:18am UTC](https://discuss.elastic.co/t/auditbeat-update-document-id/291902/1 "2021-12-15T06:18:01Z")

</div>

Good day!  
I am sending auditbeat logs to elasticserch via logstash.  
In logstash output, added document\_id parameter to update document id in elasticserch:

```auto
if "xml" in [tags] {
    elasticsearch {
      hosts => ["localhost:9200"]
      index => "GT"
      user => user
      password => password
      document_id => "%{[agent][id]}"
      doc_as_upsert => true
      action => "update"
    }
  }
}

```

At the output in elasticserch, I get only one document \_id of which does not change, but the content of the document changes, although it was expected that the documents will be = the number of logs with a unique \_id:

```auto
"hits" : {
    "total" : {
      **"value" : 1,**
      "relation" : "eq"
    },
    "max_score" : 7.95197E-5,
    "hits" : [
      {
        "_index" : "GT",
        "_type" : "_doc",
        **"_id" : "r8584d681-dd18-4523-a929-c77c04bc62c5",**
        "_score" : 7.95197E-5,
        "_source" : {
          "tags" : [
            "xml",
           ...

```

My auditbeat config:

```auto
auditbeat.modules:
- module: file_integrity
  paths:
  - C:/xml_logs/GT/xml/
  scan_at_start: true
  recursive: true
setup.template.settings:
  index.number_of_shards: 1

tags: ["xml"]

output.logstash:
  hosts: ["10.1.1.4:5044"]

processors:
  - drop_fields:
     fields: ["log_type", "input_type", "offset", "beat", "source"]
  - add_id: ~

logging:
  to_files: true
  files:
    path: C:/ProgramData/auditbeat/Logs
  level: debug

```

How can I get all auditbeat logs in elasticserch in different documents with a unique \_id?

---

<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 12, 2022, 8:18am UTC](https://discuss.elastic.co/t/auditbeat-update-document-id/291902/2 "2022-01-12T08:18:05Z")

</div>

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