# Symlinks with Filebeat

**URL:** <https://discuss.elastic.co/t/symlinks-with-filebeat/180679>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [May 12, 2019, 1:50am UTC](https://discuss.elastic.co/t/symlinks-with-filebeat/180679 "2019-05-12T01:50:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Exocomp](https://avatars.discourse-cdn.com/v4/letter/e/ea5d25/32.png) [@Exocomp](https://discuss.elastic.co/u/Exocomp)\
**Post date:** [May 12, 2019, 1:50am UTC](https://discuss.elastic.co/t/symlinks-with-filebeat/180679/1 "2019-05-12T01:50:43Z")

</div>

How does filebeat handle the case where the underlying file changes when using Symlinks. I understand that you have to enable "symlinks: true" for it to process symlinks where it reads the actual file.

But when the underlying file changes does it automatically pick up the new file the symlink is pointing to?

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [May 14, 2019, 1:49pm UTC](https://discuss.elastic.co/t/symlinks-with-filebeat/180679/2 "2019-05-14T13:49:26Z")

</div>

Symlinks are tricky. Filebeat tracks files by inode and device ID. I think it uses stat, which gets you the inode of the path given. In case of symlinks this is the symlink itself, not the file you point to. Given that I don't think that filebeat detects you relinking a symlink. An alternative operation filebeat would detect:

1. Create new temporary symlink with new inode
2. replace symlink with temporary symlink

```auto
$ ln -s source_file symlink.tmp
$ mv symlink.tmp symlink

```

In general, it's better to not use filebeat with symlinks.

---

<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 11, 2019, 2:02pm UTC](https://discuss.elastic.co/t/symlinks-with-filebeat/180679/3 "2019-06-11T14:02:02Z")

</div>

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