Splunk Search

Extra data

btheneghan
New Member

I have never been one to understand regex, however I need to extract everything after the first entry (#172...) into it's own field.  Let's call it manual_entry.  I'm getting tired of searching and randomly trying things.

#1724872356 exit
#1724872357 exit
#1724872463 cat .bashrc
#1724872485 sudo cat /etc/profile.d/join-timestamp-history.sh
#1724872512 exit
#1724877740 firefox

 

manual_entry

exit
exit
cat .bashrc
sudo cat /etc/profile.d/join-timestamp-history.sh
exit
firefox

 

 

Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @btheneghan ,

if you already extracted the field manual_entry and the format is always the one you descripted in your samples, you could use this regex:

| rex field=manual_entry "^\#\d+\s(?<manual_entry>.*)"

if you didn't extracted the field manual_entry and the format is always the one you descripted in your samples, you could use:

| rex "^\#\d+\s(?<manual_entry>.*)"

 Ciao.

Giuseppe

0 Karma

richgalloway
SplunkTrust
SplunkTrust

There's probably more than one way to do that.  If you want to use rex then this should do it.  It just takes everything after the first space as the manual_entry field.

| rex "\s(?<manual_entry>.*)"

 

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...