if statement in search query (2024)

The short answer is no - SPL is not a procedural language

The perhaps more helpful answer is, it depends on what you are trying to achieve. The thing to remember is that SPL processes a pipeline of events, each command in the pipeline processes the events and passes the results onto the next command in the pipeline.

Using rex to match against the values in the field can help you do conditional processing e.g. if the field contains "command sent", as in your second example, you could extract the endpoint (you may have to adjust this depending on what your events actually look like)

| rex field=msg "Security Agent uninstallation command sent.*,\s+\w+:\s+(?P<endpoint>.+)"

Events which don't have a msg field which matches the anchor string will not have the endpoint field added to them, but all the events are passed on to the next command in the pipeline.

Hopefully, that makes sense?

if statement in search query (2024)

References

Top Articles
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 5738

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.