We have updated our Terms of Service, Code of Conduct, and Addendum.

filter expresion in route with wildcard

Hi,

Maybe a simple answer (i hope). For a route we want to filer the host.name, but there are a lot of host in the list so a wildcard is the best way to filter.

So doing like 'drnms10*.dmz.somewhere.nl' in the filter for the servers matching with this wildcard.

But with a filter 'host == 'drnms10*.dmz.somewhere.nl'' wil not work. What is the best way to do this?

I tried with a C.lookup and a lookup file.. it wil work. But stil have top maintain a list. And is a C.lookup not very slow in a filter?

Thanks for the answer :)

greets

Jari

Tagged:

Answers

  • David Maislin
    David Maislin Posts: 230 mod
    edited November 2024

    host.endsWith('.dmz.somewhere.nl')

    OR

    /\.dmz.somewhere\.nl$/i.test(host)

  • Thanx David,

    Not exactly what i wanted. I like to have a filter for every host staring with drnms10 .. and everythine in between, but also ending with .dmz.somewhere.nl.

    hence the drnms10*.dmz.somewhere.nl

  • Jon Rust
    Jon Rust Posts: 482 mod

    David's answer still helps. You just need to create a regex expression that meets your needs. "Wildcard matching" is not supported in javascript.

  • David Maislin
    David Maislin Posts: 230 mod
    edited December 2024

    /^drnms10/.+\.dmz.somewhere\.nl$/i.test(host)

  • Ahhh now i see. Yes this helps indeed.

    Does it matter about the cpu resources it cost?

    I can make a filter with a lot off host in the filter or this regex.

    I don't like to use a list of servers in the filter, but when it cost a lot of cpu power (with loads of events i mean).

  • Jon Rust
    Jon Rust Posts: 482 mod

    Yes, CPU performance could be a concern. You normally want to make your filters as efficient as possible. I cannot tell from the info that you've provided what you're trying to do tho.