Splunk Search

How to change a rex field extraction to an inputs.conf file?

Splunkster45
Communicator

Here I am asking another question, but I think that this one will help me with other questions that I've had.

Currently, I've been using the rex command rex field=_raw ".*Login succeeded for user: (?.*)" to extract a user from a log file. However, this has been making other things more difficult such as tags and lookup files. I'm interested in setting this in the inputs.conf file so that the field username will be logged automatically.

http://docs.splunk.com/Documentation/Splunk/6.1.3/admin/inputsconf

It looks like regex is the key to capturing the 'user' information. I'm a little familiar with regex, but am not exactly sure of how to do this.
I believe that the code will look something like the following:

user = ".*Login succeeded for user: (?<user>.*)"
user = ".*Login failed for user: (?<user>.*)"

Does this appears to be correct?
Does calling one field a second time overide the first value or does it find all criteria that match both instances?

Unfortunately, where I work I can't update my own file and implement it. I have to send the updated inputs.conf file off to another team who will implement it. This means that I'll need to get it right the first time and am limited in the amount of testing that I can do.

Currently, our inputs.conf file has 3 components: location of log file, index and sourcetype

Thanks in advance!

0 Karma
1 Solution

aweitzman
Motivator

This looks to me like more of a job for props.conf than inputs.conf. It might look something like this:

props.conf

[appropriate-sourcetype-goes-here]
EXTRACT-user = Login (succeeded|failed) for user: (?<user>.*)

See http://docs.splunk.com/Documentation/Splunk/6.1.3/Knowledge/Createandmaintainsearch-timefieldextract... for more info on ways to do this.

View solution in original post

aweitzman
Motivator

This looks to me like more of a job for props.conf than inputs.conf. It might look something like this:

props.conf

[appropriate-sourcetype-goes-here]
EXTRACT-user = Login (succeeded|failed) for user: (?<user>.*)

See http://docs.splunk.com/Documentation/Splunk/6.1.3/Knowledge/Createandmaintainsearch-timefieldextract... for more info on ways to do this.

gkanapathy
Splunk Employee
Splunk Employee

You can also do this thru the Admin/Management UI, if your admins will let you. You do not have to edit the files directly.

0 Karma
Get Updates on the Splunk Community!

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

 Prepare to elevate your security operations with the powerful upgrade to Splunk Enterprise Security 8.x! This ...

Get Early Access to AI Playbook Authoring: Apply for the Alpha Private Preview ...

Passionate about security automation? Apply now to our AI Playbook Authoring Alpha private preview ...

Reduce and Transform Your Firewall Data with Splunk Data Management

Managing high-volume firewall data has always been a challenge. Noisy events and verbose traffic logs often ...