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!

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...