简体   繁体   English

Dockerized Kibana外部化日志

[英]Dockerized Kibana externalizing logs

I have been trying to externalize kibana logs which is running in a docker container with no luck. 我一直在尝试外部化在docker容器中运行但没有运气的kibana日志。 My docker compose is as follows: 我的泊坞窗撰写如下:

  kibana:
  image: kibana:latest
  container_name: kib
  ports:
    - "5601:5601"
  links:
    - elasticsearch
  volumes:
    - /var/log:/var/log

And Kibana.yml - logging.dest=/var/log/kibana.log 和Kibana.yml-logging.dest = / var / log / kibana.log

However when I run it I am getting an error as follows in the container: 但是,当我运行它时,在容器中收到如下错误:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: EACCES, open '/var/log/kibana.log'
    at Error (native)

It looks like a permissions issue (I am running it on Ubuntu FYI). 它看起来像是权限问题(我正在Ubuntu FYI上运行它)。 I set the permissions on the folder on the host to 7777. Any ideas? 我将主机上文件夹的权限设置为7777。有什么想法吗? Thanks 谢谢

The kibana process is run as kibana user (defined in the Dockerfile) by the ENTRYPOINT "/docker-entrypoint.sh" script . kibana进程由ENTRYPOINT "/docker-entrypoint.sh"脚本kibana用户(在Dockerfile中定义)运行。

As seen in this similar issue 从这个类似的问题中可以看出

The dockerfile creates a user named sinopia and runs everything as that. dockerfile创建一个名为sinopia的用户,并以此运行所有内容。
In general this is good practice, however, when accessing the host file system docker uses the same uid on the host as is used on the container . 通常,这是一个好习惯,但是, 当访问主机文件系统时,docker在主机上使用与容器上相同的uid Root in container has root access on host, and user sinopia with id 1000 in container is mapped to user 1000 on host. 容器中的根对主机具有根访问权限,容器中ID为1000的用户sinopia映射到主机上的用户1000。

If you create a user on the host with id 1000 you can then grant this user permissions to the host directory as desired. 如果您在ID为1000的主机上创建用户,则可以根据需要将此用户授予主机目录权限。

Check the id of the user sinatra created by the Dockerfile, and see if you can grant access to that same id on your host. 检查由Dockerfile创建的用户sinatra的ID,并查看是否可以在主机上授予对该相同ID的访问权限。

If you chmod +777 , try again the docker-compose up . 如果您使用chmod +777 ,请再次尝试docker-compose up (that is done for other docker images like libreboard ) (这是针对其他libreboard镜像,例如libreboard

The OP sharman explains in the comments why the chmod 777 wasn't effective: OP sharman 在评论中解释为什么chmod 777无效:

Yes I had the user created (so that I could run docker without sudo) and was UID 1000 GID 1000. 是的,我创建了用户(以便我可以在没有sudo的情况下运行docker),并且用户名是UID 1000 GID 1000。
However my volume mapping was incorrect - I have mapped the volume to a non existent folder on kibana and config file was point to this one. 但是我的卷映射不正确 -我已将卷映射到kibana上的一个不存在的文件夹,并且配置文件指向此文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM