Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Apache logs to mysql?

Discussion in 'EasyApache' started by jeffschips, Jan 23, 2019.

  1. jeffschips

    jeffschips Well-Known Member

    Joined:
    Jun 5, 2016
    Messages:
    56
    Likes Received:
    4
    Trophy Points:
    8
    Location:
    new york
    cPanel Access Level:
    Root Administrator
    Hello.

    All of the online tutorials for putting apache logs into mysql address Ubuntu or Debian, but as you know, Cpanel/WHM uses Centos.

    I have the latest build Centos 7.6 and wish to put the logs for one virtual domain into mysql. The tutorials for Ubuntu and Debian reference a mod_log_sql that needs to be used for those flavors and yum install mod_log_sql returns nothing.

    Anybody have some wisdom here on how to log domain logs to MySQL in Centos 7.6 on WHM/Cpanel?

    Thank you.
     
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,920
    Likes Received:
    167
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    How old are those tutorials you are reading?

    I don't think mod_log_sql has been an active project since the mid 2000's
     
  3. jeffschips

    jeffschips Well-Known Member

    Joined:
    Jun 5, 2016
    Messages:
    56
    Likes Received:
    4
    Trophy Points:
    8
    Location:
    new york
    cPanel Access Level:
    Root Administrator
    Looking for advice on how to capture apache logs into mysql. Perhaps you know of a way to do this...
     
  4. garconcn

    garconcn Well-Known Member

    Joined:
    Oct 29, 2009
    Messages:
    143
    Likes Received:
    7
    Trophy Points:
    68
    You can use rsyslog on cpanel to send apache log to LogAnalyzer server and then write it into mysql.

    Eg: /etc/rsyslog.conf

    # Forward Apache Access Log to LogAnalyzer Server
    $InputFileName /usr/local/apache/logs/access_log
    $InputFileTag apache-access
    $InputFileStateFile stat-apache-access
    $InputFileSeverity warn
    $InputFileFacility local5
    $InputRunFileMonitor

    # Forward Apache access-log to contral log server
    if $syslogtag contains 'apache-access' and $msg contains 'wp-login.php' then @192.168.1.1
    if $syslogtag contains 'apache-access' and $msg contains 'xmlrpc.php' then @192.168.1.1
     
  5. jeffschips

    jeffschips Well-Known Member

    Joined:
    Jun 5, 2016
    Messages:
    56
    Likes Received:
    4
    Trophy Points:
    8
    Location:
    new york
    cPanel Access Level:
    Root Administrator
    Indeed this sounds like a great solution.
    Should I proceed assuming that rsyslog is the standard logging facility in cpanel/WHM and not syslog?

    when I ps aux | grep syslog

    I only see:

    /usr/sbin/rsyslogd -n

    so I'm assuming it's safe to proceed.
     
  6. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    6,161
    Likes Received:
    474
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. garconcn

    garconcn Well-Known Member

    Joined:
    Oct 29, 2009
    Messages:
    143
    Likes Received:
    7
    Trophy Points:
    68
    I remember centos 5 was using syslog, centos 6&7 use rsyslog, they are similar, both will work. Let me know if you need more info. I've played with this several years ago, but I still have the configurations.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice