Windows: Логи Выключений/Перезагрузок
При диагностики проблемы, которая вызывает неожиданные перезагрузки или выключения машины под управлением Windows, важно знать, какие события могут быть с этим связаны, коды этих событий (англ. event ID) и как найти соответствующие логи.
В этой заметке я публикую коды событий, связанных с выключением/перезагрузкой системы.
Я также показываю, как просмотреть историю включений/выключений с помощью стандартного приложения «Просмотр событий» (англ. Event Viewer) или из командной строки с помощью PowerShell.
Дельный Совет: Загрузка Windows в безопасном режиме! Читать далее →
Коды Событий Выключения
Список кодов в журнале событий Windows, связанных с выключением или перезагрузкой системы:
Event ID | Описание |
---|---|
41 | Система была перезагружена без корректного завершения работы. |
1074 | Система была корректного выключена пользователем или процессом. |
1076 | Следует за Event ID 6008 и означает, что первый пользователь (с правом выключения системы) подключившийся к серверу после неожиданной перезагрузки или выключения, указал причину этого события. |
6005 | Запуск «Журнала событий Windows» (англ. Event Log). Указывает на включение системы. |
6006 | Остановка «Журнала событий Windows» (англ. Event Log). Указывает на выключение системы. |
6008 | Предыдущее выключение системы было неожиданным. |
6009 | Версия операционной системы, зафиксированная при загрузке системы. |
6013 | Время работы системы (англ. system uptime) в секундах. |
«Просмотр событий» — История Выключений
События связанные с выключениями системы (включая дату и время) могут быть просмотрены с помощью программы «Просмотр событий».
Запустить «Просмотр событий» и найти события связанные с выключениями:
- Нажмите клавишу Win , наберите eventvwr и запустите Просмотр событий
- В панели слева разверните Журналы Windows и перейдите в Система
- Щелкните правой кнопкой мыши на Система и выберите Фильтр текущего журнала.
- Введите следующие коды в поле и нажмите OK :
Дельный Совет: История команд в PowerShell! Читать далее →
Логи Выключений в PowerShell
Например, чтобы отфильтровать 10000 последних записей из системного журнала событий в Windows и отобразить только те события, которые связаны с включениями или выключениями системы, выполните:
Дельный Совет: Запуск/Остановка служб в Windows из CMD! Читать далее →
Enable or Disable Event Logs
I find the ability of the Get-WinEvent cmdlet to read event logs absolutely awesome. But I also find the lack of other commands that match the WinEvent noun disturbing 😉
To fix this, I propose to add two functions to your toolbox to either enable or disable eventlogs.
I’ve made the code compatible with version 2.0 so that you can use the code everywhere.
But there are also some limitations. The functions are designed to be used locally. I mean that that they don’t support natively credentials and remoting like the original Get-WinEvent cmdlet does.
Note also that you must have admin privileges to enable or disable a log.
Let’s see the functions in action.
- Disable two Applocker logs
- Display the Applocker logs and see which ones are enabled
- Let’s enable all applocker logs and use the passthru switch to pass directly the log to Format-Table cmdlet to report their status
That’s all folks! May the force be with you 😀
How to disable Windows 10 system log
In Windows 10 Resource Monitor I found that the system process is constantly writing C:\ProgramData\Microsoft\Windows\wfp\wfpdiag.etl at like 30-100KB/s. This equals 1TB write/year which is not healthy for SSD. There are other log write like C:\Windows\System32\LogFiles*** too.
Although logs is needed for diagnostics, it’s better to be turned on only when problem has already occured.
Is it possible to disable as much system logs as possible to decrease garbage write amoung to SSD?
3 Answers 3
By default, Windows has a huge number of log files, constantly writing data.
Two ways to stop some of this churning:
- Open the CMD prompt as Administrator: Press Windows , type cmd , press Ctrl + Shift + Enter and confirm.
- Type (or copy/paste) the following and press Enter : auditpol /set /subcategory:»Filtering Platform Connection» /success:disable /failure:enable
If this succeeds, expect fewer events to be logged.
Disable individual logs
- Open the Windows Event Viewer: press Windows R , type eventvwr.msc and press Enter .
- Scroll down to Application and Service Logs , Microsoft , Windows , WFP .
- Right-click on a log process and select Disable Log .
A useful tool to search the Event Logs by name is Nirsoft’s Full Event Log View.
Going hardcore:
If you want to disable specific event logging, go to Event Viewer and right-click on an event log you want to get rid of. Click Event Properties .
A new window should open — click XML view , where you’ll be able to see the event’s GUID. We’ll try to find the event logging service in the registry based on this GUID. Not all events have this GUID, and we won’t be able to find every GUID in the registry.
After we have our GUID, we navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\Autologger\EventLog-System in regedit , and we search for our GUID inside curved brackets.
If we find it, we can then proceed to change the Enabled and EnabledProperty keys:
I think I figured out how to get NetCore.etl to be written to hard drive instead of ssd. I ran Performance Monitor (a Windows app), drilled down to Data Collector Sets | Event Trace Sessions, right-clicked NetCore, clicked Properties in the menu that popped up, clicked the Directory tab, and browsed to the desired folder. Time will tell if the change is permanent, but at the moment the log is being written to my hard drive E:, according to Resource Monitor.
If one wished to stop the writing of NetCore.etl entirely, clicking Stop instead of Properties would presumably stop it. But I’m less confident that that change would be permanent. Some app might restart it, perhaps the next time Windows is restarted. If anyone tries this, I hope s/he will post the result in this thread.
Several other log files could be redirected (or stopped) in a similar manner.
Windows Event Log Error Constants
The following are the error codes that Windows Event Log defines.
ERROR_EVT_INVALID_CHANNEL_PATH
The specified channel path is not valid.
ERROR_EVT_INVALID_QUERY
The specified query is not valid.
ERROR_EVT_PUBLISHER_METADATA_NOT_FOUND
The provider metadata cannot be found in the resource.
ERROR_EVT_EVENT_TEMPLATE_NOT_FOUND
The template for an event definition cannot be found in the resource.
ERROR_EVT_INVALID_PUBLISHER_NAME
The specified provider name is not valid.
ERROR_EVT_INVALID_EVENT_DATA
The event data raised by the provider is not compatible with the event template definition in the provider’s manifest.
ERROR_EVT_CHANNEL_NOT_FOUND
The specified channel cannot be found. Check the channel configuration.
ERROR_EVT_MALFORMED_XML_TEXT
The specified XML text was not well-formed. For more information, call the EvtGetExtendedStatus function.
ERROR_EVT_SUBSCRIPTION_TO_DIRECT_CHANNEL
You cannot subscribe to an Analytic or Debug channel; the events for an Analytic or Debug channel go directly to a log file and cannot be subscribed to.
ERROR_EVT_CONFIGURATION_ERROR
A configuration error occurred.
ERROR_EVT_QUERY_RESULT_STALE
The query result is not valid. This may be due to the log being cleared or rolling over after the query result was created. Release the query result object and reissue the query.
ERROR_EVT_QUERY_RESULT_INVALID_POSITION
The cursor for the query result is not pointing to a valid position.
ERROR_EVT_NON_VALIDATING_MSXML
The registered MSXML parser does not support validation.
ERROR_EVT_FILTER_ALREADYSCOPED
An expression can be followed by a change of scope operation only if the expression evaluates to a node set and is not already part of some other change of scope operation.
ERROR_EVT_FILTER_NOTELTSET
Cannot perform a step operation from a term that does not represent an element set.
ERROR_EVT_FILTER_INVARG
The arguments on the left side of a binary operator must be either attributes, nodes, or variables, and the arguments on the right side must be constants.
ERROR_EVT_FILTER_INVTEST
A step operation must involve either a node test or, in the case of a predicate, an algebraic expression against which to test each node in the node set identified by the preceding node set can be evaluated.
ERROR_EVT_FILTER_INVTYPE
This data type not supported.
ERROR_EVT_FILTER_PARSEERR
A syntax error occurred at the specified position.
ERROR_EVT_FILTER_UNSUPPORTEDOP
This operator is unsupported by this implementation of the filter.
ERROR_EVT_FILTER_UNEXPECTEDTOKEN
The token encountered was unexpected.
ERROR_EVT_INVALID_OPERATION_OVER_ENABLED_DIRECT_CHANNEL
The requested operation cannot be performed over an enabled Analytic or Debug channel. You must disable the channel before performing the requested operation.
ERROR_EVT_INVALID_CHANNEL_PROPERTY_VALUE
The channel property contains a value that is not valid. The value’s type may not be valid, the value may be out of range, or the value cannot be updated or is not supported for this type of channel.
ERROR_EVT_INVALID_PUBLISHER_PROPERTY_VALUE
The provider property contains a value that is not valid. The value’s type may not be valid, the value may be out of range, or the value cannot be updated or is not supported for this type of provider.
ERROR_EVT_CHANNEL_CANNOT_ACTIVATE
The channel failed to activate.
ERROR_EVT_FILTER_TOO_COMPLEX
The XPath expression exceeded supported complexity. Simplify the expression or split it into two or more simple expressions.
ERROR_EVT_MESSAGE_NOT_FOUND
The message resource is present, but the message is not found in the string or message table.
ERROR_EVT_MESSAGE_ID_NOT_FOUND
The message identifier cannot be found.
ERROR_EVT_UNRESOLVED_VALUE_INSERT
The substitution string for the insert index cannot be found.
ERROR_EVT_UNRESOLVED_PARAMETER_INSERT
The description string for parameter reference (%1) cannot be found.
ERROR_EVT_MAX_INSERTS_REACHED
The maximum number of replacements has been reached.
ERROR_EVT_EVENT_DEFINITION_NOT_FOUND
The event definition cannot be found for the event identifier.
ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND
The locale-specific resource for the desired message is not present.
ERROR_EVT_VERSION_TOO_OLD
The resource is too old to be compatible.
ERROR_EVT_VERSION_TOO_NEW
The resource is too new to be compatible.
ERROR_EVT_CANNOT_OPEN_CHANNEL_OF_QUERY
The channel at the specified index of the query cannot be opened.
ERROR_EVT_PUBLISHER_DISABLED
The provider has been disabled and its resources are not available. This can occur when the provider is uninstalled or upgraded.
ERROR_EVT_FILTER_OUT_OF_RANGE
Attempted to create a numeric type that is outside of its valid range.
Как отключить Event Log
Очень нужно отключить Event log, комп тормозит из-за него, что делать?
P.S. Отключить ведение журнала Windows 7
Считывание событий из Windows Event Log
Подскажите рабочий пример считывания событий из Windows Event Log. В сети ни одного примера нет.
Сервис, который слушает event log
SOS! Программа должна запускатся сразу после подключения/откл. к Internet-у, т.е реагировать на.
Получить доступ ко всем Windows Event Log локальной машины
Ребята привет, у меня появилось подобное задание получить доступ ко всем Windows Event Log.
Как узнать координаты мышки из event:Event
как из переменной event достать координаты? knob_MC.addEventListener(MouseEvent.MOUSE_DOWN.
Решение
Заказываю контрольные, курсовые, дипломные и любые другие студенческие работы здесь или здесь.
Событие Event.COPY Event.PASTE Event.CUT
Привет я не знаю как написать код в котором текстовое поле реагировало бы на события.
по заданым значениям х и у найти значение величины log x y (log с основанием х )
я в принципе понимаю как написать эту программу,но,хоть убейте,в хелпе visual studio 2008 не могу.
По заданым значениям х и у найти значение величины log x y (log с основанием х)
Подскажите,где ошибка в if-else.Потому-что,когда вводить вместо х или у 0,почему-то еррор не.
WebBrowser не поддерживает Event MouseDown и Event MouseUp
Здравствуйте, у меня имеется WebBrowser control в windowsFormApp, но он не поддерживает Event.