Windows logs + SIdecar + Nxlog

Hello,

I am sending Windows event logs (specifically event id 4625) from Graylog to a SNMP server , however the snmp server could not read the log format therefore unable to convert it into snmp trap. Can I get any help on this topic please?

Thanks,

Hello,

SNMP is used to communicate management information between the management stations and the agents. In other words, SNMP is the protocol by which the agent and the management station communicate.

Can I ask what your trying to accomplish with a SNMP server?
This Event ID 4625 is unique for windows event logs and is sent using different protocol. If your trying to get hardware information SNMP server can get the OID’s from the MIB’s on your SNMP Server.

Thanks Gsmith.

We have SNMP server to send the alarms to our NOC for monitoring. I am using Graylog for log collection and sending security logs to the SNMP server.

I am using event id 4625 to capture the windows logon failures. Here is my NxLog config file:

define ROOT C:\Program Files (x86)\nxlog

Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogFile %ROOT%\data\nxlog.log
LogLevel INFO

<Extension logrotate>
    Module  xm_fileop
    <Schedule>
        When    @daily
        Exec    file_cycle('%ROOT%\data\nxlog.log', 7);
     </Schedule>
</Extension>

<Extension gelfExt>
  Module xm_gelf
  # Avoid truncation of the short_message field to 64 characters.
  ShortMessageLength 65536
</Extension>

<Route route-1>
  Path eventlog => gelf
</Route>
<Route route-2>
  Path file => gelf
</Route>

<Extension _gelf>
  Module xm_gelf
</Extension>

<Input win>
	Module im_msvistalog
         Query     <QueryList>                        \
               <Query Id="0" Path="Security">            \
                <Select Path="Security">*</Select>    \
               </Query>                \
              </QueryList>
</Input>

<Output graylog>
	Module om_udp
	Host XXX
	Port 12201
	OutputType  GELF
	</Output>
	
	<Route graylog_route>
	Path win => graylog
</Route>

I am receiving duplicate information as full_message and message fields. I want to remove message field and get only below fields from full_message:

Message An account failed to log on.
Account Name
Account Domain
Work Station Number
Failure Reason

Thanks for your help.

Hello,

I’m a little confused. SNMP sever/s uses SNMP protocol, not UDP /GELF so I’m not sure how you are trying to ingest syslog logs on your SNMP Server.

Since you stated your using Nxlog maybe something inhere might help.

@Raynu
By the way I had to edit you last post it was hard to read. When posting Logs, Code and Configuration please use the markup , Thanks

I am successfully sending other syslogs(linux, routers) to the SNMP servers and they can be easily converted into traps. The problem could be GELF format as well

If you can explain in greater detail it would help to solve your issue. By telling use your successfully are doing doesn’t help troubleshoot the issue. For a better understanding please read this post here.

Or perhaps the link above I post may help.

Thanks

I took another look at you Nxlog configuration file . Maybe something like this would help.

 <Extension gelf>
    Module      xm_gelf
</Extension>

<Input eventlog>
     Module    im_msvistalog
    <QueryXML>
        <QueryList>
            <Query Id="0">
                <Select Path="Security">*[System[(Level=4) and (EventID=4625)]]</Select>
            </Query>
         </QueryList>
    </QueryXML>
</Input>

<Output udp>
    Module      om_udp
    Host        192.168.1.1
	Port         12201
    OutputType  GELF_UDP
</Output>

<Route eventlog_to_udp>

    Path        eventlog => udp
</Route>

Edit: I also found this.

http://www.chapelhill.homeip.net/horton/publications/HowToGenerateSNMPtrapsFromWindowsEvents.html

Sorry, I was just cautious on putting examples here. Let me know if you still have questions regarding the issue:

Below is a syslog message for login failure which my snmp server reads correctly and can process because the format is syslog with normal message size 4096 bytes.

The message I am receiving from Windows is a very long message with below fields and while processing snmp server throws an error “the message is too long”. So, I am considering truncating the full message field to just have a useful information.

**AuthenticationPackageName**
**Category**
**Channel**
**EventID**
**EventReceivedTime**
**EventType**
**FailureReason**
**IpAddress**
**IpPort**
**KeyLength**
**Keywords**
**LmPackageName**
**LogonProcessName**
**LogonType**
**Opcode**
**OpcodeValue**
**ProcessID**
**ProcessName** 
**ProviderGuid**
**RecordNumber**
**Severity**
**SeverityValue**
**SourceModuleName**
SourceModuleType
SourceName
Status
SubStatus
SubjectDomainName
SubjectLogonId
SubjectUserName
SubjectUserSid
TargetDomainName
TargetUserName
TargetUserSid
Task
ThreadID
TransmittedServices
Version
WorkstationName
XXX
full_message

An account failed to log on. Subject: Security ID: XXX Account Name: Account Domain: XXX Logon ID: XXX Logon Type: X Account For Which Logon Failed: Security ID: XXX Account Name: XXX Account Domain: XXX Failure Information: Failure Reason: Account locked out. Status: XXX Sub Status: XX Process Information: Caller Process ID: 0x270 Caller Process Name: C:\Windows\System32\lsass.exe Network Information: Workstation Name: XX Source Network Address: XXX.XX Source Port: XXX Detailed Authentication Information: Logon Process: Advapi Authentication Package: XXXTransited Services: - Package Name (NTLM only): - Key Length: 0 This event is generated when a logon request fails. It is generated on the computer where access was attempted. The 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. The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network). The Process Information fields indicate which account and process on the system requested the logon. The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases. The authentication information fields provide detailed information about this specific logon request. - Transited services indicate which intermediate services have participated in this logon request. - Package name indicates which sub-protocol was used among the NTLM protocols. - Key length indicates the length of the generated session key. This will be 0 if no session key was requested.
level
3
message
An account failed to log on. Subject: Security ID: XXX Account Name: Account Domain: XXX Logon ID: XXX Logon Type: X Account For Which Logon Failed: Security ID: XXX Account Name: XXX Account Domain: XXX Failure Information: Failure Reason: Account locked out. Status: XXX Sub Status: XX Process Information: Caller Process ID: 0x270 Caller Process Name: C:\Windows\System32\lsass.exe Network Information: Workstation Name: XX Source Network Address: XXX.XX Source Port: XXX Detailed Authentication Information: Logon Process: Advapi Authentication Package: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0 Transited Services: - Package Name (NTLM only): - Key Length: 0 This event is generated when a logon request fails. It is generated on the computer where access was attempted. The 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. The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network). The Process Information fields indicate which account and process on the system requested the logon. The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases. The authentication information fields provide detailed information about this specific logon request. - Transited services indicate which intermediate services have participated in this logon request. - Package name indicates which sub-protocol was used among the NTLM protocols. - Key length indicates the length of the generated session key. This will be 0 if no session key was requested.
level
3
source
XXX
timestamp
XXX

Hello,

I understand, when posting make sure you cut out personal information.
Thank you for the added information.

Suggestions:

Starting from your Windows Device/s, I would limit the type of Messages you want to send.

Example of what you have.

<QueryList>
<Query Id="0" Path="Security">            \
                <Select Path="Security">*</Select>    \
               </Query>                \
 </QueryList>

You could do something like this.

 <QueryList>
           <Query Id="0">
               <Select Path="Security">*[System[(Level=1  or Level=2 or Level=3 or Level=4 or Level=0) and (EventID=1102 or EventID=4719 or EventID=4704 or EventID=4717 or EventID=4738 or EventID=4798 or EventID=4705 or EventID=4674 or EventID=4697 or EventID=4648 or EventID=4723 or EventID=4946 or EventID=4950 or EventID=6416 or EventID=6424 or EventID=4732)]]</Select>
</Query>
</QueryList>

NEXT If your other devices are sending SNMP to your SNMP server
the transport would be UDP unless you have a SNMPv3 . So, there for you may want to set your Output to something like this.

 <Output udp>
    Module      om_udp
    Host        192.168.1.1
	Port         12201    
</Output>

I understand GELF input does create a lot of fields. You can also limit this by a static Index template.

Have you looked at the link I posted?

Thanks.

I tried to use the nxlog file format recommended and changed to output type as UDP, but not much help.

I have gone through the link which you have sent. I am not looking to configure snmp traps on windows. I just want to forward syslogs from Graylog to a remote snmp server. I think the best option is to create extractor from the message field. I will explore more.

Thanks

1 Like

Keeps us updated, I’m curious how you go about doing this.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.