Splunk Search

Is there a way to extract fields which is : separated

Hema_Nithya
Explorer

John:x:/home/John:/bin/bash 

 

is there a way to extract the field from above with colon separated.  We have many users in the above format from /etc/passwd 

John - username 

x - passwd 

/home/John - path 

Labels (3)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex "(?<username>[^:]+):(?<passwd>[^:]+):(?<path>[^:]+)"

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex "(?<username>[^:]+):(?<passwd>[^:]+):(?<path>[^:]+)"
0 Karma

Hema_Nithya
Explorer

How to deal with the empty fields between . Example there is empty field between passwd and after home directory 

userid:passwd: :/home/John: : 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex "(?<username>[^:]*):(?<passwd>[^:]*):(?<path>[^:]*)"
0 Karma

Hema_Nithya
Explorer

Thank you , let me check and update you ! 

0 Karma
Get Updates on the Splunk Community!

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...

Adoption of Infrastructure Monitoring at Splunk

  Splunk's Growth Engineering team showcases one of their first Splunk product adoption-Splunk Infrastructure ...