How to set access.log and error.log files to zero length

Discussion in 'Nginx' started by mstdmstd, Oct 29, 2017.

  1. #1
    Hello,
    With Kubuntu 16 I made small command file with lines like :
    1. rm /_wwwroot/lar/vtasks/storage/logs/*.log;
    2. rm /_wwwroot/lar/vtasks/storage/logs/*.txt;
    3. rm /_wwwroot/lar/vtasks/storage/logs/*.sql;
    4. rm /_wwwroot/lar/vtasks/storage/framework/views/*.php;
    It helps me to clear logs directory.

    But there is some problems with Appache2 access.log and error.log files, as deleting the files I need to restart
    my Appache2 to recreate access.log and error.log files.

    Is there is a way using commands to set these access.log and error.log files to zero length, without deleting them?

    I have full access to these files as it is local Appache2 server.

    Thanks!
     
    Solved! View solution.
    mstdmstd, Oct 29, 2017 IP
  2. David Morrison

    David Morrison Active Member

    Messages:
    230
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    53
    Digital Goods:
    1
    #2
    cat /dev/null > access.log
     
    David Morrison, Nov 4, 2017 IP
  3. #3
    > access.log
     
    RoseHosting, Nov 8, 2017 IP