0

i'm working on an app that generate a lot of logs , I want to create for every hour a new log file , Symfony supports files names only by days

Another option is to have Monolog rotate the files for you by using the rotating_file handler. This handler creates a new log file every day and can also remove old files automatically

Official Documentation https://symfony.com/doc/current/logging.html#how-to-rotate-your-log-files.

the User must have the possibility to delete logs , so the optimal solution for me is to delete the last log files(only the last hour not all the last day)

  1. Is it an optimal solution? or there is other solutions?
  2. Is it possible to configure in Symfony logs files by hours instead of days?
starball
  • 20,030
  • 7
  • 43
  • 238
Badr MOUMOUD
  • 166
  • 2
  • 10

1 Answers1

0

As the documentation states:

Over time, log files can grow to be huge, both while developing and on production. One best-practice solution is to use a tool like the logrotate Linux command to rotate log files before they become too large.

Instead of rotating the logs with monolog, you can use logrotate.

You can even check this question to see more resources on hourly rotate.

Vinicius Dias
  • 664
  • 3
  • 15