September 26, 2019 at 6:23 pm
Does anyone have a script that I could use to export my SQL Server Log to a text file?
Your help is greatly appreciated.
September 26, 2019 at 6:52 pm
They already are text files.
On my local machine, this is the path: C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Log
Each of them are stored as ERRORLOG, ERRORLOG.1, ERRORLOG.2 and so forth. They can be opened with any text editor.
Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
September 26, 2019 at 6:55 pm
I believe that SQL Server logs are already text files. On your server, take a look at the following or equivalent folder:
C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Log
The files named: ERRORLOG.* are the SQL Server error logs in text format.
The files named: SQLAGENT.* are the SQL Server Agent logs in text format.
If you don't have direct access to the drive it is installed on, then you could use xp_readerrorlog to get a listing:
September 27, 2019 at 1:09 am
I believe the SQL Server Log and SQL Server Error log are different; the SQL Server Log is what I need help with exporting. Is this log found in the same directory as the error log?
September 27, 2019 at 2:04 pm
I believe the SQL Server Log and SQL Server Error log are different; the SQL Server Log is what I need help with exporting. Is this log found in the same directory as the error log?
No, they are not.
If you are looking at "SQL Server Logs" in SSMS, that is contained in the ERRORLOG, ERRORLOG.1, and so forth.
If you are looking at "Error Logs" under SQL Agent in SSMS, that is contained in the SQLAGENT.* files.
As Chris said, you can use xp_readerrorlog to get to the data in these files via query.
Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
September 27, 2019 at 10:42 pm
Got it! Thanks so much.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply