Menu

General questions about reports

sarg
Aleksey
2016-09-15
2016-09-21
  • Aleksey

    Aleksey - 2016-09-15

    Good afternoon.

    Established sarg 2.3.10 on Centos 6.8. The program works and reports on a schedule:
    0 * / 1 * * * root / bin / sarg> / dev / null 2> & 1

    Why reports are created in such a range?
    11/09/2016-12/09/2016
    11/09/2016-13/09/2016
    11/09/2016-14/09/2016
    11/09/2016-15/09/2016

     
  • Evgeniy Yakushev

    Логи ротируются раз в неделю. SARG запускается без параметров, он берет по дефолту access.log и даты отчета будут с с даты самой первой записи по самую последнюю.

    Чтобы получить отчет за какой-то определенный день, нобходимо запустить так:
    /bin/sarg -d 11/09/2016 > / dev / null 2> & 1
    /bin/sarg -d 12/09/2016 > / dev / null 2> & 1
    и т.д.

     
  • Aleksey

    Aleksey - 2016-09-15

    Спасибо за ответ!
    А ротация логов это настройка sarg или системы?
    Не подскажете тогда, как поступить, вернее настроить cron, чтобы отчеты за прошлые дни были вида:
    11/09/2016-11/09/2016
    12/09/2016-12/09/2016
    ....
    Но при этом за текущий день также отчет создавался каждый час.

     
  • Frederic Marchal

    I don't understand Evgeniy's answer and I may not be the only one :-) so, to spare anyone interested in the answer a trip to Google translation, I'll repeat it in English.

    When sarg is executed without arguments (as you do), it generates a report containing the full access.log. The report is named after the dates found in the log.

    As the access.log grows, more days are added to the log. Therefore, sarg sees an access.log covering more days and it adjusts the report name accordingly.

    To generate a report covering only the current day, run sarg like this:

    /bin/sarg -d day-0
    

    But I recommend you run sarg only once per day, during the morning, to generate yesterday's report like this:

    0 1 * * * root /bin/sarg -d day-1 > /dev/null 2> &1
    

    It will spare the CPU and disk, especially if the log is big. The report will contain only one day worth of data and no entry will be missing (as compared to running sarg -d day-0 and missing any entry added to the log after sarg was run for the last time that day).

    As your log appears to be rotated away, make sure you follow the advice in [Keeping enough log to process].

     

    Related

    Wiki: Keeping enough log to process

  • Aleksey

    Aleksey - 2016-09-15

    Frederic Marchal thanks for the reply.
    Sorry, that is not in English communicated with Eugene :)

    Thanks to your answers, I found a solution:
    0 1 * * * root / bin / sarg -d day-1> / dev / null 2> & 1
    0 * / 1 * * * root / bin / sarg -d day-0> / dev / null 2> & 1

    This will create the report:

    1. for the last day
    2. In the current day and updated each hour
     
  • Aleksey

    Aleksey - 2016-09-19

    Good afternoon.
    Could you tell why the report shows that it was done at 11 pm, when cron executes the task at 01:00?
    0 1 * * root / bin / sarg -d day-1> / dev / null 2> & 1!

     

    Last edit: Aleksey 2016-09-19
  • Evgeniy Yakushev

    Do you have a job for sarg in /etc/cron.daily/ ?

     
  • Aleksey

    Aleksey - 2016-09-19

    No. Configured via /etc/crontab.

     
  • Aleksey

    Aleksey - 2016-09-21

    I do not know what changed, but the date of reporting became displayed normally.

     

Log in to post a comment.

MongoDB Logo MongoDB