Reporting

Regex question/request

Mike6960
Path Finder

Is it possible to use regex to extract values in events that always end with .PDF ? I have got a chain of events, somewhere in this process a PDF doucment is generated, So the name of the PDF is not in all the events.

0 Karma

dmarling
Builder

Based on the example you provided in the question comments, this should return the data you are looking for:

| rex "(?<PDFFileName>\S+)\.[Pp][Dd][Ff]"

Here's the regex101 link showing it function on your example: https://regex101.com/r/OyLl8z/1

If this comment/answer was helpful, please up vote it. Thank you.
0 Karma

jpolvino
Builder

Sounds like you're saying that you're looking for all events related to one that eventually generates a PDF? If so then is there a unique identifier that ties them all together? I'm asking because you could use a subsearch to gather all unique identifiers from those "PDF" events, and then use those identifiers later in your search to find relates events.

Posting a sample list of events will help.

0 Karma

somesoni2
Revered Legend

YOu should be able to use following regex (assuming that youru PDF file name contains alphanueric characters only)

your base search | rex "(?<PDFFileName>[A-z0-9_]+\.(pdf|PDF))"

Again, for better solution, please provide sample data and highlight the portion you want to extract.

Mike6960
Path Finder

Thanks, almost what I need, due to the lack of me supplying an example not quite everything I need.

this is a fragment of the events:

: Get file ABC_6_2019-09-30_VK-161.2285507.pdf from /opt/mulesoft/

I would like to extract the values: ABC_6_2019-09-30_VK-161.2285507.pdf
It always ends with .PDF but the first part can differ, in my example it starts with ABC but this can also be ZZ for example

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Please share some sample data and what you want extracted from it.

---
If this reply helps you, Karma would be appreciated.
0 Karma

Mike6960
Path Finder

this is a fragment of the events:

: Get file ABC_6_2019-09-30_VK-161.2285507.pdf from /opt/mulesoft/

I would like to extract the values: ABC_6_2019-09-30_VK-161.2285507.pdf
It always ends with .PDF but the first part can differ, in my example it starts with ABC but this can also be ZZ for example

0 Karma
Get Updates on the Splunk Community!

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...