Graylog Pipeline rule

1. Describe your incident:
Hello,

I am new to Graylog. I have deployed the server and i am receiving messages from endpoints. I am working on filtering messages to extract only certain fields in all messages drop the rest. Below is my pipeline rule that i have applied to my default stream and i see througputs but it is not doing what it is expected to do.

rule “normalize_events”
when
has_field(“Category”)
then
remove_field(“Keywords”);
remove_field(“LogonTYpe”);
remove_field(“OpCode”);
remove_field(“OpCodeValue”);
remove_field(“ProcessID”);
remove_field(“ProviderGuid”);
remove_field(“RecordNumber”);
remove_field(“SeverityValue”);
remove_field(“SourceModuleName”);
remove_field(“SourceModuleType”);
remove_field(“TargetLogonId”);
remove_field(“TargetUserSid”);
remove_field(“Task”);
remove_field(“ThreadID”);
remove_field(“Version”);
remove_field(“Logon Type”);
remove_field(“level”);
end

For the moment, i am collecting logs from windows environment using NXLOG and output using GELF_UDP

Below is a sample event i would love to extract only few fields and drop the rest. Can someone point me in the right direction ?

Category
Logoff
Channel
Security
EventID
4634
EventReceivedTime
2023-08-22 15:35:45
EventType
AUDIT_SUCCESS
LogonType
3
Opcode
Info
OpcodeValue
0
Severity
INFO
SourceName
Microsoft-Windows-Security-Auditing
TargetDomainName
MYDOMNAIN
TargetUserName
Username
full_message
An account was logged off.

Subject:
Security ID: S-1-5-21-355331191-1240482024-1780769950-12996
Account Name:
Account Domain:
Logon ID: 0xB07E255

Logon Type: 3

This 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.
message
An account was logged off.

Subject:
Security ID: S-1-5-21-
source

timestamp
2023-08-22 19:35:45.000

Have you confirmed that your pipeline rule is running at all, is it making changes to the measages, or are they being stored just as they come in?

Yes my pipe line is running, it doesnt make any change to the messages that come in. They are stored as it is

@abamus, first, do you have a stream connected to the pipeline?

Second, do you see the fields you reference in the events as they come in?

Third, what is your Message Processors Configuration order in System/Configurations? Specifically, is the Message Filter Chain above or below the pipeline processor?

@chris.black-gl yes my pipeline is connected to my default stream as shown below

Yes i still see the fields as the messages come in. Also, my Messge Filter Chain is above the pipeline processor

@chris.black-gl here is my Message Filter Chain as well

Hmm… Can you post a screenshot of one message expanded to show the parsed fields please? Please choose one that has the field “Category”.

@chris.black-gl Below is a messaged with field ‘Category’

Is the GELF_UDP input part of the default stream, or is it in a different stream?

@faen yes it is part of the default stream, that is my global inputs

Are you running Graylog 5.1.x? If so there is a somewhat easy way to troubleshoot this.

Yes i am running 5.1. Ive looked everywhere for this easy fix but i am not finding it. Also as i said earlier, i am new to Graylog but i ve successfully deployed it and ingesting my logs, created dashboards etc. The only part i am still struggling with is the pipeline tules

@abamus, am I correct to presume you are using an extractor to parse the messages originally? Do you mind sharing what kind?

I can’t see an obvious error, but it occurs to me that it may be in the hand-off between the extractor and the pipelline rule. It should work, since the message chain is running before the pipeline processor, but by moving them both into the pipeline, you could eliminate a step and use the simulator to test each rule.

@chris.black-gl i am not using extractor to parse the message. I am running the pipeline rule directly against the incoming messages.

Ah. OK. Good. Glad I asked. Please share your pipeline details. It should look something like this:

@chris.black-gl

If you are running 5.1 you can use the steps in this link to run the pipeline simulator and see if your rule is being matched, and what steps it is taking. Graylog 5.1 pipeline simulator | Arcade

So, you’re using a GELF input to collect them, then this pipeline to remove the fields?

@Joel_Duffield is right, the simulator may be a good place for you to track down what’s not working. The trace feature can give you some clues as it moves through the various stages.

The other thing you can do is to create a super simple rule. For example, one that says, when the condition matches, create a new field called test, with a value of “success”. If you can get that one working, try adding the remove field for one field and see if that works.

If every single message has the Category field, you can make the when condition a simple

when
true

then
do_stuff

end.

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