2

I am trying to set up logging for a service in Google Cloud Run. The service writes logs to /var/log/logfile.log, which is one of the options described in the google logging docs. That document says logs written to /var/log will automatically be picked up and shown in google cloud logging, but they are not. Am I missing something?

When I run the service locally with docker I can see that it successfully writes to /var/log, so I assume it is successfully writing them there in cloud run as well.

I am writing the logs in json format, and they are really long, is there a log size limit?

  • Can you share how do you create the file and how do you write in it? – guillaume blaquiere Dec 29 '20 at 20:56
  • @guillaumeblaquiere the service writes to the file through Julia's IO. Julia is kind of an obscure language, but pretty sure thats not the issue because it creates and writes to the file just fine locally. The file is created by the write call if its not already there. – Fisher Moritzburke Dec 29 '20 at 21:51
  • Ok, here my 2 concerns (related to my question): Do you write your file directly in the `/var/log` or do you create a subdirectory in it? Do you flush your file buffer correctly? – guillaume blaquiere Dec 30 '20 at 10:09
  • Could you share the code on how are you writing the logs please? – Soni Sol Dec 31 '20 at 00:54
  • 1
    @guillaumeblaquiere if one uses subsdirectory as symbolic link, would that still pick up by cloud logging? – Basit Oct 07 '22 at 20:17
  • Am facing the same issue as well. Am writing logs under /var/log/rails/* which is symlinked to the action log location. – Shankar Thyagarajan May 04 '23 at 11:38

0 Answers0