# What should I set "Document to index" so that the index connector write content of source log to index?

**URL:** <https://discuss.elastic.co/t/what-should-i-set-document-to-index-so-that-the-index-connector-write-content-of-source-log-to-index/370111>\
**Category:** Elastic Security\
**Created:** [November 6, 2024, 10:10am UTC](https://discuss.elastic.co/t/what-should-i-set-document-to-index-so-that-the-index-connector-write-content-of-source-log-to-index/370111 "2024-11-06T10:10:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinlin](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@kevinlin](https://discuss.elastic.co/u/kevinlin)\
**Post date:** [November 6, 2024, 10:10am UTC](https://discuss.elastic.co/t/what-should-i-set-document-to-index-so-that-the-index-connector-write-content-of-source-log-to-index/370111/1 "2024-11-06T10:10:27Z")

</div>

There is a log with field "winlog.logon.failure.sub\_status" and content is "User logon with misspelled or bad password"

Refer to [Index connector and action | Kibana Guide [8.15] | Elastic](https://www.elastic.co/guide/en/kibana/8.15/index-action-type.html)  
I created a rule that using index connector and setting of "Document to index" is:

```auto
{
  "failedreason": "{{winlog.logon.failure.sub_status}}"
}

```

"failedreason" field exist in index that index connector link to but content is empty.

What can I do?

---

<div class="post-metadata">

**Author:** ![lesio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lesio/32/89323_2.png) [@lesio](https://discuss.elastic.co/u/lesio)\
**Post date:** [November 6, 2024, 11:36am UTC](https://discuss.elastic.co/t/what-should-i-set-document-to-index-so-that-the-index-connector-write-content-of-source-log-to-index/370111/2 "2024-11-06T11:36:18Z")

</div>

I think you are looking for [Copy fields | Filebeat Reference [8.15] | Elastic](https://www.elastic.co/guide/en/beats/filebeat/current/copy-fields.html) processor

---

<div class="post-metadata">

**Author:** ![kevinlin](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@kevinlin](https://discuss.elastic.co/u/kevinlin)\
**Post date:** [November 7, 2024, 3:38am UTC](https://discuss.elastic.co/t/what-should-i-set-document-to-index-so-that-the-index-connector-write-content-of-source-log-to-index/370111/3 "2024-11-07T03:38:27Z")

</div>

Thank you for reply.  
I think the problem is not described correctly, I will describe it again

---

<div class="post-metadata">

**Author:** ![strawgate](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/strawgate/32/131008_2.png) [@strawgate](https://discuss.elastic.co/u/strawgate)\
**Post date:** [November 8, 2024, 9:13pm UTC](https://discuss.elastic.co/t/what-should-i-set-document-to-index-so-that-the-index-connector-write-content-of-source-log-to-index/370111/4 "2024-11-08T21:13:13Z")

</div>

I couldn't find any good examples of this but I believe you'll need to do something like

```auto
{
    "failedreason": "{{#context.hits}}{{winlog.logon.failure.sub_status}}{{/context.hits}}"
}

```

---

<div class="post-metadata">

**Author:** ![Patrick\_Mueller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrick_mueller/32/109425_2.png) [@Patrick\_Mueller](https://discuss.elastic.co/u/Patrick_Mueller)\
**Post date:** [November 13, 2024, 3:05pm UTC](https://discuss.elastic.co/t/what-should-i-set-document-to-index-so-that-the-index-connector-write-content-of-source-log-to-index/370111/5 "2024-11-13T15:05:39Z")

</div>

You should try `{{_source.winlog.logon.failure.sub_status}}`

see: {{winlog.logon.failure.sub\_status}}

---

<div class="post-metadata">

**Author:** ![kevinlin](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@kevinlin](https://discuss.elastic.co/u/kevinlin)\
**Post date:** [November 26, 2024, 7:20am UTC](https://discuss.elastic.co/t/what-should-i-set-document-to-index-so-that-the-index-connector-write-content-of-source-log-to-index/370111/6 "2024-11-26T07:20:26Z")

</div>

Unlucky, It doesn't work.  
failedreason is empty

---

<div class="post-metadata">

**Author:** ![kevinlin](https://avatars.discourse-cdn.com/v4/letter/k/57b2e6/32.png) [@kevinlin](https://discuss.elastic.co/u/kevinlin)\
**Post date:** [November 26, 2024, 7:21am UTC](https://discuss.elastic.co/t/what-should-i-set-document-to-index-so-that-the-index-connector-write-content-of-source-log-to-index/370111/7 "2024-11-26T07:21:07Z")

</div>

Unlucky, It doesn't work.  
failedreason is empty.

---

<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:** [December 24, 2024, 7:21am UTC](https://discuss.elastic.co/t/what-should-i-set-document-to-index-so-that-the-index-connector-write-content-of-source-log-to-index/370111/8 "2024-12-24T07:21:52Z")

</div>

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