The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Modsec database 1GB of logs

Discussion in 'Workarounds and Optimization' started by bsasninja, Feb 11, 2010.

  1. bsasninja

    bsasninja Well-Known Member

    Joined:
    Sep 2, 2004
    Messages:
    528
    Likes Received:
    0
    Trophy Points:
    16
    I have this database and has logs from 2007, how do I flush all the logs??

    the database is at /var/lib/mysql/modsec

    Thanks
     
  2. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    An easy method would be to use phpMyAdmin via root WHM access to empty the table "modsec" within the database "modsec" -- all records are stored within the table.

    Please refer to the following WHM menu path and documentation:
    WHM: Main >> SQL Services >> phpMyAdmin
     
  3. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    mod_security database very large on server.

    I just noticed that the mod_security database is well over a gigabyte on some of our servers.

    What's a good method of resetting, zeroing out this database, and by the way, what the heck is this database for?

    Thanks for any advice.
     
  4. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Re: mod_security database very large on server

    Moderator Note: For ease of finding related information I have merged two threads discussing the "modsec" MySQL database.

    The MySQL database named "modsec" is used for storing log information from mod_security; if Mod Security is installed via EasyApache this data may be queried via the following menu path in WHM: Main >> Plugins >> Mod Security

    Please see the following post for information on how to empty or reset the mod_security MySQL database "modsec": cPanel Forums - View Single Post - Modsec database 1GB of logs
     
  5. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    Thanks. Is this just a matter of accessing the modsec database in phpMyAdmin and then clicking the trash can (empty) in the table row? And then afterward mod_security on the server will hum along just fine?

    Sorry, after all these years I am still a MySQL novice.
     
  6. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Using phpMyAdmin to Empty or "reset" the Mod Security database in MySQL

    Yes; using the action "Empty" will correctly reset the contents of the affected database table. The action should reset it as if there are no log entries stored and I believe it will work without issue.

    Here are the steps I would use to empty or reset the Mod Security database in MySQL:
    1.) Access the following menu path: WHM: Main >> SQL Services >> phpMyAdmin
    2.) Via the left-side browser frame navigate to the database named "modsec."
    3.) Via the left-side browser frame navigate to the table named "modsec" -- this will Browse the table contents.
    4.) Via the right-side browser frame click the red-colored action named "Empty." Please be careful; do not click "Drop."
     
    #6 cPanelDon, Feb 19, 2010
    Last edited: Feb 19, 2010
  7. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    Thanks very much for these detailed instructions. In using them I was able to take down my /var load from 86% full down to 71% full.

    This is something I had been struggling with every single night, i.e. keeping var from filling up.

    Thanks once again!
     
  8. VeZoZ

    VeZoZ Well-Known Member

    Joined:
    Dec 14, 2002
    Messages:
    248
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    Maybe it would be a good idea to have some sort of old data removal built into the mod_security plugin? So maybe it's set be the administrator saying logs older than 6 months are removed or something? Just a thought as seems to be topics about this issue once in a while. So why not add some automation to this so people are not having issues with data that is several years old.
     
  9. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    I recommend to consider suggesting the desired enhancement (e.g., that could clean-up or expire old entries in the mod_security MySQL database) as a feature request in the following area on our forums; this will help bring more attention to your request and as more interest gathers it may be considered for implementation: Feature Requests for cPanel and WHM - cPanel Forums

    If needed, upon request we can relocate your post into the Feature Requests forum area as a new thread.
     
  10. jols

    jols Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,111
    Likes Received:
    2
    Trophy Points:
    38
    Thanks cPanelDon.

    First, I'd much rather see cPanel.net come up with a way to set individual email account defaults, which is the leading cause of premature hair loss around here.
     
Loading...

Share This Page