Use regex in path definition


#1

Is it possible to use regex when defining the path? I see the documentation states it uses Golang Glob which seems to indicate that it's possible, but I can't seem to get it to work.

I have the following:

filebeat.prospectors:

- input_type: log

  paths:

    - E:\server\logs\[0-9]{8}.log

I've tried a few variations of this too. I'm essentially after the following type of files:

E:\server\logs\20170111.log

The folder contains other .log files that I want to ignore though. Any help much appreciated.

Thanks,
Dave


(Magnus B├Ąck) #2

I see the documentation states it uses Golang Glob which seems to indicate that it's possible

But glob expressions and regexps are not the same thing.

How about looking for 20??????.log?


#3

Hi Magnus,

Yes, you're right - it seems I was looking at the wrong bit of the Golang docs.

I actually got it working with something very similar:

20*.log

I think I prefer your method though, it's slightly more precise.

By the time 2100 comes around, I'll (hopefully) be retired :slight_smile:


(system) #4

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