Use SQLSERVER to record site logs _ PHP Tutorial

Source: Internet
Author: User
Use SQLSERVER to record site logs. Originally, the W3C format can be used. The problem is that sometimes you may want to record the log to another server. in this way, even if there is a problem, the log will not be discarded, another way to use SQL for logging is to use W3C format.
The problem is that sometimes you may want to record the log to another server, so that even if there is a problem, the log will not be lost.
Besides, another benefit of using SQL for logging is that it facilitates access and query in code and statistics.
This statistics is no longer accurate.
Besides, it is not complicated to use SQL statements to record site logs.
1. create a database in the SQL of the target server, for example, YAOANLOG.
2. run the script for generating IIS logs in the database. the script is in the IIS server folder c: windowssystem32inetsrv named logtemp. run SQL to generate a data table named inetlog.
3. on the iis server, open the ODBC manager and create a system DSN named YAOANLOG. select SQL server as the driver, and enter the IP address, verification, and SQL server Verification of the SQL SERVER, enter the username and password, select the newly created YAOANLOG database, and test the database.
4. open the IIS Manager and select the site for logging. in the log format, select ODBC
Next, click properties.
In the property, DSN name, enter YaoAnLog
Table name, input inetlog
User name, enter your SQL SERVER user name, password, and password
Finally, press OK to enter the password again.
After confirmation, stop the site and restart the site.
If the setting is correct, connect to the target SQL SERVER and use the query Analyzer. you should be able to see the access log.
In addition, the IIS Help mentioned: "If ODBC logs are used, IIS will disable the core cache, and performance will be affected"
Therefore, do not use it unless necessary.


The logging problem is that sometimes you may want to record the log to another server. in this way, even if there is a problem, the log will not be lost. there is another log record using SQL...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.