# Filebeat doesn't send data when executed as daemon

**URL:** https://discuss.elastic.co/t/filebeat-doesnt-send-data-when-executed-as-daemon/161932
**Category:** Beats
**Tags:** filebeat
**Created:** [December 22, 2018, 11:51pm UTC](https://discuss.elastic.co/t/filebeat-doesnt-send-data-when-executed-as-daemon/161932 "2018-12-22T23:51:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![leanfrei](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@leanfrei](https://discuss.elastic.co/u/leanfrei)
#### Post date: [December 22, 2018, 11:51pm UTC](https://discuss.elastic.co/t/filebeat-doesnt-send-data-when-executed-as-daemon/161932/1 "2018-12-22T23:51:19Z")

</div>

Hi,  
I've installed filebeat in an Amazon Linux and changed the /etc/init.d/filebeat to run as a non root user called "filebeat-usr". I also changed ownership of all filebeat files to "filebeat-usr".  
When I do sudo su filebeat-usr and then "filebeat -e", filebeat sends data to my ElasticSearch cluster successfully. But when I run sudo service filebeat start from a sudoer user, the service starts up nice, but it's not able to send nothing to ElasticSearch.

I was having this problem: " ERROR log/input.go:209 input state for /home/someuser/applog.log was not removed: stat /home/someuser/applog.log: permission denied". Which is weird, because I was able to run stat on this file while logged as filebeat-usr. Anyway, I removed the registry file in /var/lib/ and this error message is not appearing anymore, unfortunately no data is coming to ES cluster.

Does any one knows what it could be?

---

<div class="post-metadata">

### Author: ![leanfrei](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@leanfrei](https://discuss.elastic.co/u/leanfrei)
#### Post date: [December 23, 2018, 3:48am UTC](https://discuss.elastic.co/t/filebeat-doesnt-send-data-when-executed-as-daemon/161932/2 "2018-12-23T03:48:09Z")

</div>

I was able to figure out what it was. The logs were owned by other user, and although I had placed the filebeat user within the same group of the log producer user, and the group had read permission on the logs, I still needed to add a parameter in filebeat-god script. So, to fix this I edit the /etc/init.d/filebeat init script and added to wrapperopts variable the parameter -g $beat\_group, where $beat\_group is my unix user group.

```auto
#group that can read the log files
beat_group=mygroup

["$beat_user" != "root"] && wrapperopts="$wrapperopts -u $beat_user -g $beat_group"

```

---

<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 20, 2019, 3:48am UTC](https://discuss.elastic.co/t/filebeat-doesnt-send-data-when-executed-as-daemon/161932/3 "2019-01-20T03:48:11Z")

</div>

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