<p>I am running a Laravel application on Kubernetes and currently have a requirement to mount a storage/log folder from multiple pods where all pods will write to the same <code>laravel.log</code> file. To achieve this, I used AWS EFS with the EFS-Provisioner for Kubernetes to mount the storage.</p>

<p>While troubleshooting a logging issue from my application, I noticed that when I log an entry to the <code>laravel.log</code> file from Pod A/B, it shows up in both Pod A/B when I tail the log however it does not show up in Pod C. If I log from Pod C, it will only show up in Pod C. I am working inside the container using <code>php artisan tinker</code> and <code>Log::error('php-fpm');</code> for example as well as <code>tail -f /var/www/api/storage/logs/laravel.log</code>. The same behaviour happens if I <code>echo "php-fpm" &gt;&gt; /var/www/api/storage/logs/laravel.log</code>.</p>

<p>At first, I thought that I was possibly mounting the wrong storage however if I <code>touch test</code> in the folder, I can see it across Pod A, B, C. I can also see the other log files that are created with identical timestamps.</p>

<p>Any ideas on how to fix this?</p>

<p><strong>Edit:</strong> I noticed that pod A, B which are both seeing each others log entries are in the same AZ. Pod C (and another Pod D running Nginx) are running in a different AZ. I just want to outline this, but I feel like this really shouldn't matter. It should be the same storage no matter where you are connecting from.</p>

leeman24
<p>AWS EFS is accessed using NFS protocol and according to <a href="https://unix.stackexchange.com/a/299653">this stack exchange answer</a> simultaneous writes from multiple NFS clients to the same file will be corrupted.</p>

<p>I'm not sure there is a way of "fixing" NFS itself but you can always just log to separate files.</p>
