0

How this can be achieve? I have a catalina.out log in a prod server which is growing fast in space. 6.7 GB in couple of days . I had the Idea at the begging to create a cronjob to be executed 2 or 3 days a week to run a script that copy catalina log to Azure blob storage and then wipe it out with just a command "echo "" > file". But moving 2 GB to azure every day that cron job executes don´t know if is the best idea either. way too big file. Is there a way that the logs is in another server/azure storage? Where should I configuer that? I read something about implementing log4j with tomcat, is this possible also? that catalina.out using log4j move it to other server? Howcan I achieve this?. I know that development team should check also why is growing and logging so fast this file, but in the meantime I need a solution to implement.

thanks!!

Chanafot
  • 736
  • 4
  • 22
  • 46

1 Answers1

0

I read something about implementing log4j with tomcat, is this possible also?

I think what you want to describe is Log Rotation, if you want to use this way, here is a blog about how to configure it.

I had the Idea at the begging to create a cronjob to be executed 2 or 3 days a week to run a script that copy catalina log to Azure blob storage

Yes, you could choose this way to manage log, however I still have something to say. If you want to upload the log file to Azure Blob, I think you may get error for the large file . You need split large file into multiple small file. In this article, under the title Upload a file in blocks programmatically, there is detailed description.

From you description, you are not using Azure Web, so if you choose Azure Web , you could also use Azure Functions or WebJobs to do the cronjob.

If you still have other questions, please let me know.

George Chen
  • 13,703
  • 2
  • 11
  • 26
  • isn´t it Webjobs for webapps? this is a server VM in azure. Also yes I will have to implement something with log4j to rotate logs to Azure blobs, do you think I can do that? didn´t found much in the itnernet for doing it. – Chanafot Dec 17 '18 at 13:10
  • @Valebian yes, webjob is a function under azure webapps, if you still want to manage logs manually, you could choose Azure Function. – George Chen Dec 18 '18 at 01:00
  • yeap that for log rotation, but need to know specific how to configure log4j it for log rotation and to move it to azure. Will let you know, thanks – Chanafot Dec 20 '18 at 15:17