Few days ago i have installed elasticsearch,

For diagnosing some problems on my elasticsearch setup, i have checked the logs files located in /var/log/elasticsearch and tailed them but apparently the directory's owner is elasticsearch and the group is elasticsearch, therefore i have resolved it by switching to root and apply the tail (not an elegant way).

Now I would like to write a simple script to tail those files (I'm using tmux), Does anybody has a suggestion how to overcome the the privileges issue while using a script? I prefer keeping the ownership to elasticsearch user.

  • Will the script be run by root? – Panki May 15 at 7:10
  • I prefer not, although I can. – JammingThebBits May 15 at 7:12

Considering 'Stuart' is the user running your script, you can :

  • make Stuart a member of the elasticsearch group (provided group members can actually access these log files)
  • OR make the directory + logs readable by Stuart. This implies :

    • setting the execution bit on /var/log/elasticsearch so that Stuart can enter it
    • setting the read bit on /var/log/elasticsearch/whatever.log so that Stuart can actually read it
  • OR define sudo privileges (but this sounds overkill)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.