Apache2 logrotate

Discussion in 'General' started by variable99, Dec 18, 2023.

  1. variable99

    variable99 Member

    I want to add "prerotate" event to logrotate. Since ISPC handles log rotation in custom way - is there any .sh script which I could modify to achieve my goal? I want to count unique IPs before each logrotate event.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Why do you want to count them before rotation? Rotation is done exactly at midnight and you can access yesterday's log for 24 hours under a fixed name (see log folder, there is always a symlink for yesterday's log pointing to the right log file), so if you want to count IP addresses for a day, it makes more sense to write a script that runs e.g. at 1am that goes trough all logs and counts IP addresses.
     
    ahrasis and variable99 like this.
  3. variable99

    variable99 Member

    Hm, and in case there is no yesterday log I could mark it as 0. Thank you!
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Correct, if there is no yesterday log file, then apache has not logged anything yesterday. E.g. GoAccess, webalizer and awstats all calculate stats on yesterday's log as well.
     

Share This Page