Hi, I'm testing Nxlog EE trial

And configured nxlog as WEC with im_wseventing module, but for some reason $EventType field Parsed to simple "AUDIT" not AUDIT_SUCCESS or AUDIT_FAILURE In doc Possible values are: CRITICAL, ERROR, AUDIT_FAILURE, AUDIT_SUCCESS, INFO, WARNING, and VERBOSE.

Example of Event:

<14>Jun 14 15:13:33 SRVTEST-00.test Microsoft-Windows-Security-Auditing[648]: 
  "MessageID": "uuid:1DB8B636-E34C-4DB5-951D-EEE30FD8F837",
  "SourceName": "Microsoft-Windows-Security-Auditing",
  "ProviderGuid": "{54849625-5478-4994-A5BA-3E3B0328C30D}",
  "EventID": 4634,
  "Version": 0,
  "LevelValue": 0,
  "EventType": "AUDIT",
  "SeverityValue": 2,
  "Severity": "INFO",
  "OpcodeValue": 0,
  "Keywords": "0x8020000000000000",
  "EventTime": "2019-06-14 15:13:33",
  "RecordNumber": 3437460,
  "ExecutionProcessID": 648,
  "ExecutionThreadID": 4980,
  "Channel": "Security",
  "Hostname": "SRVTEST-00.test",
  "TargetUserSid": "S-1-5-18",
  "TargetUserName": "SRVTEST-00$",
  "TargetDomainName": "TEST",
  "TargetLogonId": "0x2b06461",
  "LogonType": "3",
  "Message": "An account was logged off.\n\nSubject:\n\tSecurity ID:\t\tS-1-5-18\n\tAccount Name:\t\tSRVTEST-00$\n\tAccount Domain:\t\tTEST\n\tLogon ID:\t\t0x2B06461\n\nLogon Type:\t\t\t3\n\nThis event is generated when a logon session is destroyed. It may be positively correlated with a logon event using the Logon ID value. Logon IDs are only unique between reboots on the same computer.",
  "Level": "Information",
  "Task": "Logoff",
  "Opcode": "Info",
  "EventReceivedTime": "2019-06-14 15:13:35",
  "SourceModuleName": "wseventin",
  "SourceModuleType": "im_wseventing",
  "HostIP": ""

My nxlog config:

User nxlog
Group nxlog
Panic Soft

# default values:
 PidFile   /opt/nxlog/var/run/nxlog/nxlog.pid
 CacheDir  /opt/nxlog/var/spool/nxlog
 ModuleDir /opt/nxlog/libexec/nxlog/modules
 SpoolDir /opt/nxlog/var/spool/nxlog

define LOGDIR /opt/nxlog/var/log/nxlog
define MYLOGFILE %LOGDIR%/nxlog.log


<Extension _syslog>
    Module  xm_syslog

<Extension json>
    Module              xm_json

<Extension _resolver>
    Module      xm_resolver

<Extension _fileop>
    Module  xm_fileop

    # Check the size of our log file hourly, rotate if larger than 5MB
        Every   1 hour
            if ( file_exists('%MYLOGFILE%') and
                 (file_size('%MYLOGFILE%') >= 5M) )
                 file_cycle('%MYLOGFILE%', 8);

    # Rotate our log file every week on Sunday at midnight
        When    @weekly
        Exec    if file_exists('%MYLOGFILE%') file_cycle('%MYLOGFILE%', 8);

<Input wseventin>
    Module              im_wseventing
    Address             http://srvtest-12.test:80/wsman
    Port                80
    SubscriptionName    testing
    Exec                $HostIP = name_to_ipaddr($Hostname);
    Exec                log_info(to_json());
            <Query Id="0">
                <Select Path="Application">*</Select>
                <Select Path="Security">*</Select>
                <Select Path="System">*</Select>

<Output tofile>
  Module    om_file
  File  '/opt/nxlog/var/log/nxlog/winevent.log'
  CreateDir   TRUE
 Exec $Message = to_json(); to_syslog_bsd();

<Route wec_to_file>
    Path wseventin => tofile

Is it bug or trial restrictions?

AskedJune 14, 2019 - 2:43pm

Comments (3)

  • Zhengshi's picture

    This shouldn't be a trial restriction. I would suggest taking off the Exec $Message = to_json(); to_syslog_bsd(); from your Output and see if this information is indeed captured through WEF.
    Once you have taken that off, please update this post and we can see if this might be a bug.

  • RAZR's picture

    Hi Zhengshi, thank you for answer

    I'm trying to taking off Exec $Message = to_json(); to_syslog_bsd(); from output but EventType not presented in RAW payload, nxlog should map event id to category AUDIT_SUCCESS or AUDIT_FAILURE as I understand it.

    I think this is a bug because with different module im_msvistalog, seems that this properties parsing correctly.

      "EventTime": "2019-06-19T16:37:57.971290+02:00",
      "Hostname": "SRVTEST-04.test",
      "Keywords": "9232379236109516800",
      "EventType": "AUDIT_SUCCESS",
      "SeverityValue": 2,
      "Severity": "INFO",
      "EventID": 4624,
      "SourceName": "Microsoft-Windows-Security-Auditing",
      "ProviderGuid": "{54849625-5478-4994-A5BA-3E3B0328C30D}",
      "Version": 1,
      "TaskValue": 12544,
      "OpcodeValue": 0,
      "RecordNumber": 1217359,
      "ExecutionProcessID": 528,
      "ExecutionThreadID": 3104,
      "Channel": "Security",
      "Message": "An account was successfully logged on.\r\n\r\nSubject:\r\n\tSecurity ID:\t\tS-1-0-0\r\n\tAccount Name:\t\t-\r\n\tAccount Domain:\t\t-\r\n\tLogon ID:\t\t0x0\r\n\r\nLogon Type:\t\t\t3\r\n\r\nImpersonation Level:\t\tImpersonation\r\n\r\nNew Logon:\r\n\tSecurity ID:\t\tS-1-5-21-1315597011-3697177239-1496635439-1104\r\n\tAccount Name:\t\tSRVTEST-04$\r\n\tAccount Domain:\t\tBZ0\r\n\tLogon ID:\t\t0x63729C1\r\n\tLogon GUID:\t\t{7D6A65E9-3390-D55F-4D26-1E0239A1C376}\r\n\r\nProcess Information:\r\n\tProcess ID:\t\t0x0\r\n\tProcess Name:\t\t-\r\n\r\nNetwork Information:\r\n\tWorkstation Name:\t-\r\n\tSource Network Address:\t-\r\n\tSource Port:\t\t-\r\n\r\nDetailed Authentication Information:\r\n\tLogon Process:\t\tKerberos\r\n\tAuthentication Package:\tKerberos\r\n\tTransited Services:\t-\r\n\tPackage Name (NTLM only):\t-\r\n\tKey Length:\t\t0\r\n\r\nThis event is generated when a logon session is created. It is generated on the computer that was accessed.\r\n\r\nThe subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.\r\n\r\nThe logon type field indicates the kind of logon that occurred. The most common types are 2 (interactive) and 3 (network).\r\n\r\nThe New Logon fields indicate the account for whom the new logon was created, i.e. the account that was logged on.\r\n\r\nThe network fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.\r\n\r\nThe impersonation level field indicates the extent to which a process in the logon session can impersonate.\r\n\r\nThe authentication information fields provide detailed information about this specific logon request.\r\n\t- Logon GUID is a unique identifier that can be used to correlate this event with a KDC event.\r\n\t- Transited services indicate which intermediate services have participated in this logon request.\r\n\t- Package name indicates which sub-protocol was used among the NTLM protocols.\r\n\t- Key length indicates the length of the generated session key. This will be 0 if no session key was requested.",
      "Category": "Logon",
      "Opcode": "Info",
      "SubjectUserSid": "S-1-0-0",
      "SubjectUserName": "-",
      "SubjectDomainName": "-",
      "SubjectLogonId": "0x0",
      "TargetUserSid": "S-1-5-21-1315597011-3697177239-1496635439-1104",
      "TargetUserName": "SRVTEST-04$",
      "TargetDomainName": "BZ0",
      "TargetLogonId": "0x63729c1",
      "LogonType": "3",
      "LogonProcessName": "Kerberos",
      "AuthenticationPackageName": "Kerberos",
      "WorkstationName": "-",
      "LogonGuid": "{7D6A65E9-3390-D55F-4D26-1E0239A1C376}",
      "TransmittedServices": "-",
      "LmPackageName": "-",
      "KeyLength": "0",
      "ProcessId": "0x0",
      "ProcessName": "-",
      "IpAddress": "-",
      "IpPort": "-",
      "ImpersonationLevel": "%%1833",
      "EventReceivedTime": "2019-06-19T16:38:29.884685+02:00",
      "SourceModuleName": "eventlog",
      "SourceModuleType": "im_msvistalog"

  • b0ti's picture

    im_msvistalog came after im_mseventlog that was developed so that it would produce output compatible with what the Snare agent gave. In this case the windows eventlog is read through the API and the EventType field is constructed based on the following logic:

            case WINEVENT_AUDIT_TYPE:
            if ( keywords & WINEVENT_AUDIT_FAILURE )
                nx_logdata_set_string(logdata, "EventType", "AUDIT_FAILURE");
            else if ( keywords & WINEVENT_AUDIT_SUCCESS )
                nx_logdata_set_string(logdata, "EventType", "AUDIT_SUCCESS");

    As you can see it takes the keywords flag into consideration.

    On the other hand with WEF the event is rendered on the client side into XML and im_wseventing simply uses that string value, that's why you get AUDIT only.

Answers (0)