2

I have a Apache2 perl application running in a docker container in Elastic Beanstalk, and I'm having problems getting at the Apache2 logs.

This is my Dockerrun.aws.json file...

{
  "AWSEBDockerrunVersion": "1",
  "Ports": [
    {
      "ContainerPort": "80"
    }
  ],
  "Volumes": [
    {
      "HostDirectory": "/container_mnt/www/",
      "ContainerDirectory": "/var/www/"
    },
    {
      "HostDirectory": "/var/log/docker_apache2/",
      "ContainerDirectory": "/var/log/apache2/"
    }
  ],
  "Logging": "/var/log/docker_apache2"
}

I have a .ebextensions config file that sets up the instance folder...

container_commands:
  01-command:
    command: mkdir -p /container_mnt
  02-command:
    ... do stuff to setup my application folder in /var/www/ ...
  03-command:
    command: mkdir -p /var/log/docker_apache2

When I connect to the instance with ssh I can see that the logs are being written to the correct folder. However the apache logs are not included when I retrieve the logs from the console.

Is there something else I need to do to get logging to appear here?

user1751825
  • 4,029
  • 1
  • 28
  • 58

1 Answers1

3

It turns out I was misunderstanding the purpose of the "Logging" attribute. I thought it referred to an host folder, but it's actually supposed to be a container folder.

I just had to change the value to be...

"Logging": "/var/log/apache2/"

and remove the entry from the Volumes array.

user1751825
  • 4,029
  • 1
  • 28
  • 58