Extract file name and add as a field

Hi bro and sis

I will be sending file from filebeat to logstash. Is there a way I can extract file name on logstash filter? I want to add as a new field

My file name
Path/sample.log
Path/sample.20210821

Your small advice and example is big help to me

There are many ways to do this. See here and here for examples.

I tried as below

```
filter {
  grok {
    match => ["path","%{GREEDYDATA}/%{GREEDYDATA:filename}\.log"]
  }
}
```

But in filename field it giving .log .how to have only name without extension?