Help Center > > FAQs> Log Management> How Can I Obtain Microsoft SQL Server Error Logs Using Commands?

How Can I Obtain Microsoft SQL Server Error Logs Using Commands?

Updated at: May 26, 2020 GMT+08:00
  1. Log in to the Microsoft SQL Server client as user rdsuser.
  2. Run the following statement to query error logs:

    EXECUTE master.dbo.rds_read_errorlog FileID,LogType,FilterText,FilterBeginTime,FilterEndTime

    • FileID: indicates the ID of an error log. The value 0 indicates the latest logs.
    • LogType: indicates the log type. The value 1 indicates error logs and value 2 indicates agent logs.
    • FilterText: indicates a keyword, which can be NULL.
    • FilterBeginTime: indicates the start time in queries, which can be NULL.
    • FilterEndTime: indicates the completion time in queries, which can be NULL.

    Example:

    EXEC master.dbo.rds_read_errorlog 0,1,'FZYUN','2018-06-14 14:30','2018-06-14 14:31'

    Figure 1 shows the query results.

    Figure 1 Example query results

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel