What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi guys! How do you configure spryker in docker to send the log from yves and zed directly to the st

URB1K7DEU
URB1K7DEU Posts: 10 πŸ§‘πŸ»β€πŸš€ - Cadet

Hi guys! How do you configure spryker in docker to send the log from yves and zed directly to the stdout? They are directly sent to Kibana. I currently have:

$config[LogConstants::LOG_FILE_PATH_YVES] = '<php://stdout>';
$config[LogConstants::LOG_FILE_PATH_ZED] = '<php://stdout>';
$config[LogConstants::EXCEPTION_LOG_FILE_PATH_YVES] = '<php://stderr>';
$config[LogConstants::EXCEPTION_LOG_FILE_PATH_ZED] = '<php://stderr>';
$config[QueueConstants::QUEUE_WORKER_OUTPUT_FILE_NAME] = '<php://stdout>';

And in php-fpm I set:

php_admin_value[error_log] = /proc/self/fd/2

I see the errors in Zed, but not in Yves. Anyone has figured this out?

Comments

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet
    <php://stdout>
    

    Won’t work at all. As php-fpm does not support proxying to /proc/self/fd/1.

    So only /proc/self/fd/2 and <php://stderr> would work.

  • UQ958DA4U
    UQ958DA4U Posts: 232 πŸ§‘πŸ»β€πŸš€ - Cadet

    We are using a Filebeat companion container for this.

  • UMZRJAE7M
    UMZRJAE7M Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    we're using a file with symlink like nginx does in their official image:
    https://docs.docker.com/config/containers/logging/

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet

    @UMZRJAE7M I would like to ask the details…

    The problem I face is that php-fpm worker cannot access neither /proc/1/fd/2 or /dev/stderr. So symlink does not work.

  • UMZRJAE7M
    UMZRJAE7M Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    @ULYHPR789 good to know - we wanted to switch to symlink because our solution is not that nice

    current solution is that we create a fifo file that we use as log destination. In our entrypoint, we use:

    mkfifo /var/log/stdout
    chmod 666 /var/log/stdout

    and in the Spryker config, we use /var/log/stdout as log destination

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet

    How do you create a link?

  • UMZRJAE7M
    UMZRJAE7M Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    well, this solution is without link, that's why I said not so nice

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited May 2020

    Ok. How do you redirect /var/log/stdout into docker container output?

  • UMZRJAE7M
    UMZRJAE7M Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    it's a fifo file. If I get it right, it's content is automatically posted into stdout

  • UMZRJAE7M
    UMZRJAE7M Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    ah, we tail it via supervisord

    command=tail -f /var/log/stdout

  • UMZRJAE7M
    UMZRJAE7M Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    as I said, not that nice

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ok. That explains.

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet

    Symlink does not work. As worker has no permission to write into php-fpm process output.

  • UMZRJAE7M
    UMZRJAE7M Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    thx for that information - I wanted to switch to symlink soon

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet

    However <php://stderr> works properly. The only thing to do is to set the following for php-fpm pool

    catch_workers_output = yes
    decorate_workers_output = no
    
  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet

    At that point it works properly.

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet

    But console commands are different case. We are trying to find a way to redirect logs spawned by scheduled console commands (e.g. Jenkins) into container output.

  • UMZRJAE7M
    UMZRJAE7M Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    that's still an open point in our setup

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited May 2020

    I will notify you about our solution when it becomes mature.

  • UMZRJAE7M
    UMZRJAE7M Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet
  • UMZRJAE7M
    UMZRJAE7M Posts: 31 πŸ§‘πŸ»β€πŸš€ - Cadet

    so in php 7.3 <php://stdout> should work

  • sprymiker
    sprymiker Cloud Platform Architect Sprykee Posts: 781 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yep. I’ve already mentioned the decorate_workers_output = no

    So web requests are good. CLI is still not clear.