{"id":4222,"date":"2013-09-18T14:10:13","date_gmt":"2013-09-18T21:10:13","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/paul\/?p=4222"},"modified":"2013-09-18T14:16:49","modified_gmt":"2013-09-18T21:16:49","slug":"how-to-tell-who-changed-a-log-file-characteristic","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/","title":{"rendered":"How to tell who changed a log file characteristic?"},"content":{"rendered":"<p>My good friend Orson Weston (@weston12) posted a question to #sqlhelp on Twitter earlier:\u00a0<em>Is there a way out of the box to find when and who changed the max file size for a log file?<\/em><\/p>\n<p>You can&#8217;t tell this from the default trace as that just logs that the database was altered, not the log file.<\/p>\n<p>But yes, I can tell you who made a change to the configuration of the log file for a database, using transaction log analysis.<\/p>\n<p>I just ran the following code to set up the demo:<\/p>\n<pre class=\"brush: sql; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nCREATE DATABASE foo2;\r\nGO\r\nALTER DATABASE foo2\r\nMODIFY FILE (NAME = N'foo2_log', MAXSIZE = 100GB);\r\nGO\r\n<\/pre>\n<p>If I want to know who changed the log file properties, I can rely on the fact that the log file is file ID 2, and that the log file characteristics are stored in the <em>sysprufiles<\/em> hidden system table. Slot 0 in that table is the MDF, slot 1 is the LDF. Using <em>fn_dblog<\/em> to look in the transaction log for changes to that slot in that table,\u00a0I can run the following code:<\/p>\n<pre class=\"brush: sql; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nSELECT\r\n\tSUSER_SNAME (&#x5B;Transaction SID]) AS &#x5B;User],\r\n\t&#x5B;Begin Time] AS &#x5B;Change Time]\r\nFROM\r\n\tfn_dblog (NULL, NULL)\r\nWHERE\r\n\t&#x5B;Transaction ID] =\r\n\t\t(SELECT\r\n\t\t\t&#x5B;Transaction ID]\r\n\t\tFROM\r\n\t\t\tfn_dblog (NULL, NULL)\r\n\t\tWHERE\r\n\t\t\t&#x5B;Operation] = N'LOP_MODIFY_ROW'\r\n\t\t\tAND &#x5B;AllocUnitName] = N'sys.sysprufiles.clst'\r\n\t\t\tAND &#x5B;Slot ID] = 1)\r\n\tAND &#x5B;Operation] = N'LOP_BEGIN_XACT';\r\nGO\r\n<\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; toolbar: true; wrap-lines: true; notranslate\" title=\"\">\r\nUser                                        Change Time\r\n------------------------------------------- ------------------------\r\nAPPLECROSS\\paul                             2013\/09\/18 14:01:25:310\r\n<\/pre>\n<p>It&#8217;s harder to tell exactly what changed, but you can work that out by looking at the structure of the <em>sysprufiles<\/em> records and matching the <em>Offset<\/em> column in the log record in the <em>fn_dblog<\/em> output. Not impossible, but tedious. In most cases it&#8217;s enough to know that someone changed the log file characteristics at all.<\/p>\n<p>If you&#8217;re interested in a different log file (why do you have more than one?) then figure out which slot ID it is in\u00a0<em>sysprufiles<\/em> and substitute that slot ID in the code.<\/p>\n<p>And if you don&#8217;t have any information in the current transaction log, you can scan your log backups using the same code and using <em>fn_dump_dblog<\/em> instead (see <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/using-fn_dblog-fn_dump_dblog-and-restoring-with-stopbeforemark-to-an-lsn\/\" target=\"_blank\">here<\/a> for details, syntax, and a usage warning).<\/p>\n<p>Hope this helps!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My good friend Orson Weston (@weston12) posted a question to #sqlhelp on Twitter earlier:\u00a0Is there a way out of the box to find when and who changed the max file size for a log file? You can&#8217;t tell this from the default trace as that just logs that the database was altered, not the log [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[98,100],"tags":[],"class_list":["post-4222","post","type-post","status-publish","format-standard","hentry","category-transaction-log","category-undocumented-commands"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to tell who changed a log file characteristic? - Paul S. Randal<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to tell who changed a log file characteristic? - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"My good friend Orson Weston (@weston12) posted a question to #sqlhelp on Twitter earlier:\u00a0Is there a way out of the box to find when and who changed the max file size for a log file? You can&#8217;t tell this from the default trace as that just logs that the database was altered, not the log [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2013-09-18T21:10:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-09-18T21:16:49+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/\",\"name\":\"How to tell who changed a log file characteristic? - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2013-09-18T21:10:13+00:00\",\"dateModified\":\"2013-09-18T21:16:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to tell who changed a log file characteristic?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to tell who changed a log file characteristic? - Paul S. Randal","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/","og_locale":"en_US","og_type":"article","og_title":"How to tell who changed a log file characteristic? - Paul S. Randal","og_description":"My good friend Orson Weston (@weston12) posted a question to #sqlhelp on Twitter earlier:\u00a0Is there a way out of the box to find when and who changed the max file size for a log file? You can&#8217;t tell this from the default trace as that just logs that the database was altered, not the log [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/","og_site_name":"Paul S. Randal","article_published_time":"2013-09-18T21:10:13+00:00","article_modified_time":"2013-09-18T21:16:49+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/","name":"How to tell who changed a log file characteristic? - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2013-09-18T21:10:13+00:00","dateModified":"2013-09-18T21:16:49+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/how-to-tell-who-changed-a-log-file-characteristic\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"How to tell who changed a log file characteristic?"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/4222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=4222"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/4222\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=4222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=4222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=4222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}