I've been using Logstash for integration with Wazuh.
Usually I hadn't have any issues by this since the pipeline it's pretty straight forward.
My usuall config is the next one:
Since the error is cause permission denial, I explored the next configs in order to give it permission: Note: systemd's logstash.service file has user:logstash and group:logstash. Keep that in mind.
Change output file permissions to 666 with user:user = Same errors
Change output file permissions to 666 with user:logstash = Same errors
Change output file permissions to 666 with logstash:logstash = Same errors
Change output file permissions to 666 with root:root = Same errors
Change logstash.service file's user/group values to user:user = Same errors
Change logstash.service file's user/group values to root:root = Can't run as root
I really don't get why I get this error since every time I had implemented this short pipeline It works.
Is there some similar documentation someone can help me retrive in order to troubleshoot this error?
Or is there a correct way to analyze the debug plain log in order to learn what's happening?
This is not exactly a Logstash error, it is a Linux permission issue, directories under /home have 750 (rwxr-x---) permissions, changing the permissions of the file has no impact because the logstash user has no permissions on the parent directory.
So you would need to change the user home folder to 770 and change the group ownership to the logstash group, I would not recommend that, it would be better to change the path to a directory under /opt or /var/opt.
Another issue that you may have is that your input would bind on port 514, which is a privileged port and the logstash user would not be able to bind to it per default.
You would need to add this capability to the java process running logstash using setcap, I'm not exactly sure of what is the command, but this is pretty easy to find.
I would use another port, like 1514 and leave 514 free to be used for rsyslog if required.
Also, you mentioned that you changed the logstash service user and group to root:root , this may have messed up with the permissions and give you errors when trying to run it again as a service with the logstash user, you may have to fix the permissions of the files inside /var/lib/logstash and /var/log/logstash.
You were rigth, thanks for the tip.
I was focusing only on the output file and logstash config that I didn't consider the parent directories.
I changed the path of my logs file to /opt, the permissions of the /opt directory to 777 and gave the new file path to my pipeline to the next one /opt/logs-wazuh.json.
Fortunately, the changes I made on the service config file didn't break the logstash process. I checked the /var/lib&log/logstash and there weren't any error besides the next WARNING: [2025-04-23T10:48:50,415][WARN ][logstash.filters.grok ][main] ECS v8 support is a preview of the unreleased ECS v8, and uses the v1 patterns.
I just stay with 1 question, that is I've never need to config the parent's directory or output file permissions on the same deployment. Why does this time I needed to do it?
I mean, of course is cause' the permission config. But since I deployed the same OS, with the same config and resources on the same paths... I just don't get what was the keystone.
I want to know in order to enhance my linux sysadmin skills, so I'd appreciate any feedback you can give me.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.