How to query for exact string with nothing more?

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Locked
Sampath.Basireddy
Posts: 252
Joined: Wed Dec 14, 2016 12:30 pm

How to query for exact string with nothing more?

Post by Sampath.Basireddy »

I have a requirement to query and filter for an exact string with nothing more.

The messages has the exact string what I am looking for and some message has more text next to it, but I want to filter for only the string I am looking for.

Any way around this?

Thank You,
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: How to query for exact string with nothing more?

Post by mbellerue »

Here's a good tutorial on the syntax for Lucene query.
http://www.lucenetutorial.com/lucene-query-syntax.html

However, if you just need to filter out messages with that additional text, and that additional text is reliable, you can put this in your query.

Code: Select all

message: "I want this" -message: "But not this"
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Sampath.Basireddy
Posts: 252
Joined: Wed Dec 14, 2016 12:30 pm

Re: How to query for exact string with nothing more?

Post by Sampath.Basireddy »

Thanks @mbellerue.

What is I have a lot of messages that I want to filter out?

Here is an example:

Messages:
- NagiosXI Enterprise Server and Network Monitoring Software NagiosXI
- NagiosXI is Enterprise Server and Network Monitoring Software
- NagiosXI

If I have to filter the messages that has just "NagiosXI" and nothing more?
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: How to query for exact string with nothing more?

Post by mbellerue »

It's not a perfect solution for sure. For your exact example, you can look for common words. If you wanted just the NagiosXI message, you could do this,

Code: Select all

message: "NagiosXI" -message: "Enterprise"
Since both of the other messages have Enterprise in them, they should be stopped by the second part of the filter.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Sampath.Basireddy
Posts: 252
Joined: Wed Dec 14, 2016 12:30 pm

Re: How to query for exact string with nothing more?

Post by Sampath.Basireddy »

Thanks @mbellerue.

This may not necessarily help with my requirement, but may be to an extent.

Does this "-message" accept wild cards?
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: How to query for exact string with nothing more?

Post by mbellerue »

Yes, it will do wildcards.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Sampath.Basireddy
Posts: 252
Joined: Wed Dec 14, 2016 12:30 pm

Re: How to query for exact string with nothing more?

Post by Sampath.Basireddy »

Thanks @mbellerue.

You may close this thread.
Locked