LINUX.ORG.RU
решено ФорумAdmin

Rsyslog + LogAnalyzer + Evtsys - пишутся не полные логи из журнала Windows

 


0

2

На ОС Ubuntu 24.04 поднял rsyslog-сервер в связке с LogAnalyzer и базой данных - Maria DB.

Логи собираются с различных устройств. В данном случае с Windows-машин собираются с помощью Evtsys-агента, который работает в качестве службы.

Проблема следующего характера, если зайти в LogAnalyzer и посмотреть свойство события, то можно увидеть, что часть сообщения из Журнала Windows из раздела Security прилетает не полным.

Вот, что прилетает:

Вход в учетную запись выполнен успешно.
Субъект:
ИД безопасности:СИСТЕМА
Имя учетной записи:KSC01$
Домен учетной записи:DC
ИД входа:0x3E7
Сведения о входе:
Тип входа:11
Ограниченный режим администрирования:-
Виртуальная учетная запись:Нет
Расширенный маркер:Нет
Уровень олицетворения:Олицетворение
Новый вход:
ИД безопасности:DC\admin
Имя учетной записи:admin
Домен учетной записи:DC
ИД входа:0xC3115E0
Связанный ИД входа:0xC3115CE
Сетевое имя учетной записи:-
Сетевой домен учетной записи:-
GUID входа:{00000000-0000-0000-0000-000000000000}
Све

Вот полный лог самого журнала:

Вход в учетную запись выполнен успешно.

Субъект:
	ИД безопасности:		СИСТЕМА
	Имя учетной записи:		KSC01$
	Домен учетной записи:		DC
	ИД входа:		0x3E7

Сведения о входе:
	Тип входа:		11
	Ограниченный режим администрирования:	-
	Виртуальная учетная запись:		Нет
	Расширенный маркер:		Нет

Уровень олицетворения:		Олицетворение

Новый вход:
	ИД безопасности:		DC\admin
	Имя учетной записи:		admin
	Домен учетной записи:		DC
	ИД входа:		0xC3115E0
	Связанный ИД входа:		0xC3115CE
	Сетевое имя учетной записи:	-
	Сетевой домен учетной записи:	-
	GUID входа:		{00000000-0000-0000-0000-000000000000}

Сведения о процессе:
	ИД процесса:		0x165c
	Имя процесса:		C:\Windows\System32\consent.exe

Сведения о сети:
	Имя рабочей станции:	KSC01
	Сетевой адрес источника:	::1
	Порт источника:		0

Подробные сведения о проверке подлинности:
	Процесс входа:		CredPro
	Пакет проверки подлинности:	Negotiate
	Промежуточные службы:	-
	Имя пакета (только NTLM):	-
	Длина ключа:		0

Данное событие возникает при создании сеанса входа. Оно создается на компьютере, к которому был установлен доступ.

Поля "Субъект" указывают на учетную запись локальной системы, запросившую вход. Обычно это служба, например служба "Сервер", или локальный процесс, такой как Winlogon.exe или Services.exe.

В поле "Тип входа" указан тип выполненного входа. Самыми распространенными являются типы 2 (интерактивный) и 3 (сетевой).

Поля "Новый вход" указывают на учетную запись, для которой создан новый сеанс входа, то есть на учетную запись, в которую выполнен вход.

В полях, которые относятся к сети, указан источник запроса на удаленный вход. Имя рабочей станции доступно не всегда, и в некоторых случаях это поле может оставаться незаполненным.

Поле "Уровень олицетворения" задает допустимую степень олицетворения для процессов в данном сеансе входа.

Поля сведений о проверке подлинности содержат подробные данные о конкретном запросе на вход.
	- GUID входа — это уникальный идентификатор, который позволяет сопоставить данное событие с событием KDC.
	- В поле "Промежуточные службы" указано, какие промежуточные службы участвовали в данном запросе на вход.
	- Поле "Имя пакета" указывает на подпротокол, использованный с протоколами NTLM.
	- В поле "Длина ключа" указывается длина созданного ключа сеанса. Это поле может иметь значение "0", если ключ сеанса не запрашивался.

Первым делом я начал смотреть в таблицу Systemevents в MariaDB куда записываются логи и смотрел поле Message, куда должно записываться сообщение. Но в свойствах таблицы стоит тип «Text» - поэтому вывод не должен «урезаться».

Далее на самом клиенте Evtsys в реестре увеличил размер файла журнала до 4096 кб - также не помогло.

Далее попытался в свойствах rsyslof.conf указать $Maxmessagesize=64kb.

Это также не принесло никаких результатов.

Конфигурационные файлы:

rsyslog.conf /etc/rsyslog.conf


  GNU nano 7.2   
# /etc/rsyslog.conf configuration file for rsyslog
#
# For more information install rsyslog-doc and see
# /usr/share/doc/rsyslog-doc/html/configuration/index.html
#
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf

#################
#### MODULES ####
#################

module(load="imuxsock") # provides support for local system logging
#module(load="immark")  # provides --MARK-- message capability

# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")

# provides TCP syslog reception
module(load="imtcp")
input(type="imtcp" port="514")

# provides kernel logging support and enable non-kernel klog messages
module(load="imklog" permitnonkernelfacility="on")

###########################
#### GLOBAL DIRECTIVES ####
###########################

# Filter duplicated messages
$RepeatedMsgReduction on

#
# Set the default permissions for all log files.
#
$FileOwner syslog
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$PrivDropToUser syslog
$PrivDropToGroup syslog

#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog

#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf

$MaxMessageSize 64k

/var/www/html/loganalyzer/config.php
<?php
/*

конфиг loganalyzer

      *********************************************************************
        * LogAnalyzer - http://loganalyzer.adiscon.com
        * -----------------------------------------------------------------
        * Main Configuration File
        *
        * -> Configuration need variables for the Database connection
        *
        * Copyright (C) 2008-2010 Adiscon GmbH.
        *
        * This file is part of LogAnalyzer.
        *
        * LogAnalyzer is free software: you can redistribute it and/or modify
        * it under the terms of the GNU General Public License as published by
        * the Free Software Foundation, either version 3 of the License, or
        * (at your option) any later version.
        *
        * LogAnalyzer is distributed in the hope that it will be useful,
        * but WITHOUT ANY WARRANTY; without even the implied warranty of
        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        * GNU General Public License for more details.
        *
        * You should have received a copy of the GNU General Public License
        * along with LogAnalyzer. If not, see <http://www.gnu.org/licenses/>.
        *
        * A copy of the GPL can be found in the file "COPYING" in this
        * distribution.
        *
        * Adiscon LogAnalyzer is also available under a commercial license.
        * For details, contact info@adiscon.com or visit
        * http://loganalyzer.adiscon.com/commercial
        *********************************************************************
*/

// --- Avoid directly accessing this file!
if ( !defined('IN_PHPLOGCON') )
{
        die('Hacking attempt');
        exit;
}
// ---

// --- UserDB options
/*      If UserDB is enabled, all options will and have to be configured in the database.
*       All Options below the UserDB options here will not be used, unless a setting
*       is missing in the database.
*/
$CFG['UserDBEnabled'] = true;
$CFG['UserDBServer'] = 'localhost';
$CFG['UserDBPort'] = 3306;
$CFG['UserDBName'] = 'loganalyzer';
$CFG['UserDBPref'] = 'logcon_';
$CFG['UserDBUser'] = 'logan';
$CFG['UserDBPass'] = 'Password';
$CFG['UserDBLoginRequired'] = true;
$CFG['UserDBAuthMode'] = 0;     // USERDB_AUTH_INTERNAL means LogAnalyzer Internal Auth
                                                                                                // USERDB_AUTH_LDAP means Auth via LDAP Server

// LDAP Auth options
$CFG['LDAPServer'] = '127.0.0.1';                                       // LDAP server hostname or IP
$CFG['LDAPPort'] = 389;                                                         // LDAP port, 389 or 636 for SSL
$CFG['LDAPBaseDN'] = 'CN=Users,DC=domain,DC=local';     // Base DN for LDAP Search, this is a typical ActiveDirectory sample
$CFG['LDAPSearchFilter'] = '(objectClass=user)';        // Basic Search filter
$CFG['LDAPUidAttribute'] = 'sAMAccountName';            // The LDAP attribute used in the search to find the user, example: uid, cn or sAMAccountName (Active Directory)
                                                                                                        // DN of the privileged user for the search
$CFG['LDAPBindDN'] = 'CN=Searchuser,CN=Users,DC=domain,DC=local'; // "Searchuser" = the privilegied user used to query LDAP Directory
$CFG['LDAPBindPassword'] = 'Password';                          // Password of the privilegied user
// ---

// --- Misc Options
$CFG['MiscShowDebugMsg'] = 0;                           // if enabled, you will get additional output on certain places
$CFG['MiscDebugToSyslog'] = 0;                          // if enabled, debug messages from LogAnalyzer will be send to syslog on linux, and into the EventLog on Windows
$CFG['MiscShowDebugMsg'] = 0;                           // if enabled, you will get additional output on certain places
$CFG['MiscDebugToSyslog'] = 0;                          // if enabled, debug messages from LogAnalyzer will be send to syslog on linux, and into the EventLog on Windows
$CFG['MiscShowDebugGridCounter'] = 0;           // Only for debugging purposes, will add a counter column into the grid!
$CFG["MiscShowPageRenderStats"] = 1;            // If enabled, you will see Pagerender Settings
$CFG['MiscEnableGzipCompression'] = 1;          // If enabled, LogAnalyzer will use gzip compression for output, we recommend
                                                                                        // to have this option enabled, it will highly reduce bandwith usage.
$CFG['MiscMaxExecutionTime'] = 30;                      // LogAnalyzer will try to overwrite the default script timeout with this value during runtime!
                                                                                        // This can of course only work if LogAnalyzer is allowed to changed the script timeout.
$CFG['DebugUserLogin'] = 0;                                     // if enabled, you will see additional informations on failed logins
// ---

// --- Default Frontend Options
$CFG['PrependTitle'] = "";                                      // If set, this text will be prepended withint the title tag
$CFG['ViewUseTodayYesterday'] = 1;                      // If enabled, the date from today and yesterday is displayed as "today" and "yesterday"
$CFG['ViewMessageCharacterLimit'] = 80;         // Default character limit for the message gets trunscated! 0 means NO trunscation.
$CFG['ViewStringCharacterLimit'] = 30;          // Default character limit for all other string type fields before they get trunscated! 0 means NO trunscation.
$CFG['ViewEntriesPerPage'] = 50;                        // Default number of syslog entries shown per page
$CFG['ViewEnableDetailPopups'] = 1;                     // If enabled, you will see additional Details for each syslog message on mouse over.
$CFG['ViewDefaultTheme'] = "default";           // This sets the default theme the user is going to see when he opens LogAnalyzer the first time.
                                                                                        // Currently only "default" and "dark" are available.
$CFG['ViewDefaultLanguage'] = "en";                     // Sets the default display language
$CFG['ViewEnableAutoReloadSeconds'] = 0;        // If "ViewEnableAutoReloadSeconds" is set to anything higher the 0 (which means disabled), this means auto reload is enabled by default.

$CFG['SearchCustomButtonCaption'] = "I'd like to feel sad";     // Default caption for the custom fast search button
$CFG['SearchCustomButtonSearch'] = "error";                                     // Default search string for the custom search button

$CFG['EnableContextLinks'] = 1;                         // if enabled, context links within the messages will automatically be created and added. Set this to 0 to disable all context links.
$CFG['EnableIPAddressResolve'] = 1;                     // If enabled, IP Addresses inline messages are automatically resolved and the result is added in brackets {} behind the IP Address
$CFG['SuppressDuplicatedMessages'] = 0;         // If enabled, duplicated messages will be suppressed in the main display.
$CFG['TreatNotFoundFiltersAsTrue'] = 0;         // If you filter / search for messages, and the fields you are filtering for is not found, the filter result is treaten as TRUE!
$CFG['PopupMenuTimeout'] = 3000;                        // This variable defines the default timeout value for popup menus in milliseconds. (those menus which popup when you click on the value of a field.
$CFG['PhplogconLogoUrl'] = "";                          // Put an Url to a custom toplogo you want to use.
$CFG['InlineOnlineSearchIcons'] = 1;            // Show online search icons
$CFG['UseProxyServerForRemoteQueries'] = "";// If empty no proxy server will be used. If set to a proxy server url like 127.0.0.1:8080, LogAnalyzer will use this server for url queries like the updatecheck.
$CFG['HeaderDefaultEncoding'] = ENC_ISO_8859_1; // Set default character encoding
$CFG['DefaultFont'] = "Arial";                          // Sets the default Font to be used in Loganalyzer
$CFG['DefaultFontSize'] = "100";                        // Sets the percentage font size, default is 100 (Percent). Can be changed up to 200 and down to 50 with good results.
// ---

// --- Custom HTML Code
$CFG['InjectHtmlHeader'] = "";                          // Use this variable to inject custom html into the html <head> area!
$CFG['InjectBodyHeader'] = "";                          // Use this variable to inject custom html into the begin of the <body> area!
$CFG['InjectBodyFooter'] = "";                          // Use this variable to inject custom html into the end of the <body> area!
// ---

// --- Define which fields you want to see
//$CFG['ShowMessage'] = true;                                   // If enabled, the Message column will be appended to the columns list.
//Eventlog based fields: $CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_HOST, SYSLOG_EVENT_LOGTYPE, SYSLOG_EVENT_SOURCE, /*SYSLOG_EVENT_CATEGORY, */SYSLOG_EVENT_ID, SYSLOG_MESSAGE );
//$CFG['Columns'] = array ( SYSLOG_DATE, SYSLOG_FACILITY, SYSLOG_SEVERITY, SYSLOG_HOST, SYSLOG_SYSLOGTAG, SYSLOG_MESSAGETYPE, SYSLOG_MESSAGE );
$CFG['DefaultViewsID'] = "";
// ---

// --- Predefined Searches!
$CFG['Search'][] = array ( "DisplayName" => "Syslog Warnings and Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3%2C4&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "Syslog Errors", "SearchQuery" => "filter=severity%3A0%2C1%2C2%2C3&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from the last hour", "SearchQuery" => "filter=datelastx%3A1&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 12 hours", "SearchQuery" => "filter=datelastx%3A2&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 24 hours", "SearchQuery" => "filter=datelastx%3A3&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 7 days", "SearchQuery" => "filter=datelastx%3A4&search=Search" );
$CFG['Search'][] = array ( "DisplayName" => "All messages from last 31 days", "SearchQuery" => "filter=datelastx%3A5&search=Search" );
// $CFG['Search'][] = array ( "DisplayName" => "", "SearchQuery" => "" );
// ---

// --- Predefined Charts!
$CFG['Charts']['Chart1'] = array ( "DisplayName" => "Top Hosts", "chart_type" => CHART_BARS_HORIZONTAL, "chart_width" => 400, "chart_field" => SYSLOG_HOST, "maxrecords" => 10, "showpercent" => 0, "chart_enabled" => 1 );
$CFG['Charts']['Chart2'] = array ( "DisplayName" => "SyslogTags", "chart_type" => CHART_CAKE, "chart_width" => 400, "chart_field" => SYSLOG_SYSLOGTAG, "maxrecords" => 10, "showpercent" => 0, "chart_enabled" => 1 );
$CFG['Charts']['Chart3'] = array ( "DisplayName" => "Severity Occurences", "chart_type" => CHART_BARS_VERTICAL, "chart_width" => 400, "chart_field" => SYSLOG_SEVERITY, "maxrecords" => 10, "showpercent" => 1, "chart_enabled" => 1 );
$CFG['Charts']['Chart4'] = array ( "DisplayName" => "Usage by Day", "chart_type" => CHART_CAKE, "chart_width" => 400, "chart_field" => SYSLOG_DATE, "maxrecords" => 10, "showpercent" => 1, "chart_enabled" => 1 );

// --- Configure allowed directories for File base logstream sources
$CFG['DiskAllowed'][] = "/var/log/";
// ---

// --- Source Options
/* Example for DiskType Source:
        $CFG['Sources']['Source1']['ID'] = "Source1";
        $CFG['Sources']['Source1']['Name'] = "Syslog Disk File";
        $CFG['Sources']['Source1']['Description'] = "More details you want to see about this source";
        $CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK;
        $CFG['Sources']['Source1']['LogLineType'] = "syslog";
        $CFG['Sources']['Source1']['MsgParserList'] = "";
        $CFG['Sources']['Source1']['MsgNormalize'] = 0;
        $CFG['Sources']['Source1']['DiskFile'] = "/var/log/syslog";
        $CFG['Sources']['Source1']['ViewID'] = "SYSLOG";

        $CFG['Sources']['Source2']['ID'] = "Source5";
        $CFG['Sources']['Source2']['Name'] = "WinSyslog DB";
        $CFG['Sources']['Source1']['Description'] = "";
        $CFG['Sources']['Source2']['SourceType'] = SOURCE_DB;
        $CFG['Sources']['Source1']['MsgParserList'] = "";
        $CFG['Sources']['Source2']['DBTableType'] = "winsyslog";
        $CFG['Sources']['Source2']['DBType'] = DB_MYSQL;
        $CFG['Sources']['Source2']['DBServer'] = "localhost";
        $CFG['Sources']['Source2']['DBName'] = "loganalyzer";
        $CFG['Sources']['Source2']['DBUser'] = "root";
        $CFG['Sources']['Source2']['DBPassword'] = "";
        $CFG['Sources']['Source2']['DBTableName'] = "systemevents";
        $CFG['Sources']['Source2']['ViewID'] = "SYSLOG";
*/

$CFG['DefaultSourceID'] = 'Source1';

$CFG['Sources']['Source1']['ID'] = 'Source1';
$CFG['Sources']['Source1']['Name'] = 'My Syslog Source';
$CFG['Sources']['Source1']['ViewID'] = 'SYSLOG';
$CFG['Sources']['Source1']['SourceType'] = SOURCE_DB;
$CFG['Sources']['Source1']['DBTableType'] = 'monitorware';
$CFG['Sources']['Source1']['DBType'] = DB_MYSQL;
$CFG['Sources']['Source1']['DBServer'] = 'localhost';
$CFG['Sources']['Source1']['DBName'] = 'rsyslog';
$CFG['Sources']['Source1']['DBUser'] = 'syslogmaster';
$CFG['Sources']['Source1']['DBPassword'] = 'PASSWORD';
$CFG['Sources']['Source1']['DBTableName'] = 'SystemEvents';
$CFG['Sources']['Source1']['DBEnableRowCounting'] = false;

// ---

c:\windows\system32\evtsys.cfg

'!!!!THIS FILE IS REQUIRED FOR THE SERVICE TO FUNCTION!!!!
'
'Comments must start with an apostrophe and
'must be the only thing on that line.
'
'Do not combine comments and definitions on the same line!
'
'Format is as follows - EventSource:EventID
'Use * as a wildcard to ignore all ID's from a given source
'E.g. Security-Auditing:*
'
'In Vista/2k8 and upwards remove the 'Microsoft-Windows-' prefix
'In Vista/2k8+ you may also specify custom XPath queries
'Format is the word 'XPath' followed by a ':', the event log to search,
'followed by a ':', and then the select expression
'E.g XPath:Application:<expression>
'
'Details can be found in the readme file at the following location:
'https://code.google.com/p/eventlog-to-syslog/downloads/list
'**********************:**************************
'XPath:Application:<Select Path="Application">*</Select>
XPath:Security:<Select Path="Security">*</Select>
'XPath:Setup:<Select Path="Setup">*</Select>
'XPath:System:<Select Path="System">*</Select>

HKLM\SOFTWARE\ECN\EvtSys\3.0\

MaxMessageSize  0x00001000 (4096)

MariaDB размер таблиц и типа данных:

SHOW COLUMNS FROM SystemEvents;
+--------------------+------------------+------+-----+---------+----------------+
| Field              | Type             | Null | Key | Default | Extra          |
+--------------------+------------------+------+-----+---------+----------------+
| ID                 | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| CustomerID         | bigint(20)       | YES  |     | NULL    |                |
| ReceivedAt         | datetime         | YES  |     | NULL    |                |
| DeviceReportedTime | datetime         | YES  |     | NULL    |                |
| Facility           | smallint(6)      | YES  |     | NULL    |                |
| Priority           | smallint(6)      | YES  |     | NULL    |                |
| FromHost           | varchar(63)      | YES  |     | NULL    |                |
| Message            | text             | YES  |     | NULL    |                |
| NTSeverity         | int(11)          | YES  |     | NULL    |                |
| Importance         | int(11)          | YES  |     | NULL    |                |
| EventSource        | varchar(60)      | YES  |     | NULL    |                |
| EventUser          | varchar(60)      | YES  |     | NULL    |                |
| EventCategory      | int(11)          | YES  |     | NULL    |                |
| EventID            | int(11)          | YES  |     | NULL    |                |
| EventBinaryData    | text             | YES  |     | NULL    |                |
| MaxAvailable       | int(11)          | YES  |     | NULL    |                |
| CurrUsage          | int(11)          | YES  |     | NULL    |                |
| MinUsage           | int(11)          | YES  |     | NULL    |                |
| MaxUsage           | int(11)          | YES  |     | NULL    |                |
| InfoUnitID         | int(11)          | YES  |     | NULL    |                |
| SysLogTag          | varchar(60)      | YES  |     | NULL    |                |
| EventLogType       | varchar(60)      | YES  |     | NULL    |                |
| GenericFileName    | varchar(60)      | YES  |     | NULL    |                |
| SystemID           | int(11)          | YES  |     | NULL    |                |
| checksum           | int(11)          | YES  |     | NULL    |                |
| processid          | varchar(60)      | YES  |     | NULL    |                |
+--------------------+------------------+------+-----+---------+----------------+

В какую сторону следует копать? Может кто уже сталкивался с подобным?



Последнее исправление: unkgsom (всего исправлений: 5)

Поставил Nxlog-агент и логи теперь пишутся корректно. Проблема была в Evtsys-агенте, который, в силу отсутствия поддержки со стороны разработчика, стал работать криво.

Если кто столкнется с данной проблемой, то единственным решением вижу переходить на другие версии агентов.

unkgsom
() автор топика
Последнее исправление: unkgsom (всего исправлений: 1)