Splunk Search

Why is my extracted field not showing up in search result

arpitpropay
Explorer

I have several log files as source of Splunk events.

C:\logs\Srv1\file1_2019-05-06.log
C:\logs\Srv84\file3_2019-05-06.log
C:\logs\Glob9\file18_2019-05-06.log

I am trying to extract the immediate parent directory name from the source field of events. So in a custom extracted field "appname", I am hoping to get values Srv1, Srv84 and Glob9 from examples above.

Here's what I am doing.

Splunk Web > Settings > Fields > Fields Extractions > Add new

Destination app: search
Name: source_app_name
Apply to: source named: app_name
Type: Inline
Extraction/Transform: ^.+\x5C(?<appname>(.+))\x5C[^\x5C]*$

Sharing: Global, All apps, Read permission to everyone.

When I run my search ...| extract reload=t I can't find appname field in All fields. All fields is selected in the Select field list.

Am I doing anything wrong with my field extraction, or with my search?

Tags (1)
0 Karma
1 Solution

vishaltaneja070
Motivator

Hello @arpitporpay

The best way to do this is:
Go to Splunk Web > Settings > Fields > Fields Extractions > Add new

then add the below attributes:

app_name: <your app name>
name: source_app_name
sourcetype : < as per your requirement>  --- the above mentioned source is incorrect as it is asking for which source it need to apply so it is better to use sourcetype.
Type: uses trasform
extraction: appname

Go to Splunk Web > Settings > Fields > Field transformations > Add new

destination_app: <your app name>
name : appname
type: regex-based
regular expression: ^.+\x5C(?<appname>(.+))\x5C[^\x5C]*$
source_key : source

Thanks!

View solution in original post

vishaltaneja070
Motivator

Hello @arpitporpay

The best way to do this is:
Go to Splunk Web > Settings > Fields > Fields Extractions > Add new

then add the below attributes:

app_name: <your app name>
name: source_app_name
sourcetype : < as per your requirement>  --- the above mentioned source is incorrect as it is asking for which source it need to apply so it is better to use sourcetype.
Type: uses trasform
extraction: appname

Go to Splunk Web > Settings > Fields > Field transformations > Add new

destination_app: <your app name>
name : appname
type: regex-based
regular expression: ^.+\x5C(?<appname>(.+))\x5C[^\x5C]*$
source_key : source

Thanks!

vishaltaneja070
Motivator

Otherwise:

props.conf

[your_sourcetype]
REPORT-appname1= appname

transforms.conf
[appname]
REGEX= ^.+\x5C(?(.+))\x5C[^\x5C]*$
SOURCE_KEY = source

0 Karma

vishaltaneja070
Motivator

@arpitpropay : Could you please accept the answer to close the conversation.

0 Karma

arpitpropay
Explorer

Thanks @vishaltaneja07011993 your solution (using field transformation in field extraction) worked for me.

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...