Getting Data In

index only part of a log?

gregwilliams
Path Finder

Is there a way to index only part of a log? These logs are custom log files from a windows server. There are thousands of files, each file belonging to an AD user, and the files are updated when a user logs onto/off of a domain machine. I don't want the entire log to be index because there is a lot of junk in there that I don't need or want to index. For example this is the structure:

Date | Time | user | macaddress | IP | Function | computer name | AD Display Name | share directory | then a bunch of other garbage | etc.

Basically I need everything but share directory, AD Display name, macaddress, and the other garbage.

The windows server that the files are sitting on is separate from the splunk server.

1 Solution

lguinn2
Legend

Here is the easiest and most efficient way to do it. On the Splunk server, put the following in

$SPLUNK_HOME/etc/system/local/props.conf

[source::nameoffiles]
TRUNCATE = 100

TRUNCATE says "only index the first 100 characters of each event." The 100 is arbitrary, but if you can figure out a reasonable value for your situation, it will work well. And if you sometimes get a a little bit of the "garbage" in there, you can just ignore it.

For the "nameoffiles", you must specify the input files that should be affected. You can use wildcards here, but be careful. And you do need to specify the full path name, etc. Take a look in the manual for more info about props.conf.
You could specify the same thing, but using the sourcetype of the data instead - if the data all has the same sourcetype:

[yoursourcetypename]
TRUNCATE = 100

There are other ways to do this, but they require more processing, etc.

View solution in original post

gregwilliams
Path Finder

Thanks! The fields are fixed length so this works perfectly for what I'm trying to do.

0 Karma

lguinn2
Legend

Here is the easiest and most efficient way to do it. On the Splunk server, put the following in

$SPLUNK_HOME/etc/system/local/props.conf

[source::nameoffiles]
TRUNCATE = 100

TRUNCATE says "only index the first 100 characters of each event." The 100 is arbitrary, but if you can figure out a reasonable value for your situation, it will work well. And if you sometimes get a a little bit of the "garbage" in there, you can just ignore it.

For the "nameoffiles", you must specify the input files that should be affected. You can use wildcards here, but be careful. And you do need to specify the full path name, etc. Take a look in the manual for more info about props.conf.
You could specify the same thing, but using the sourcetype of the data instead - if the data all has the same sourcetype:

[yoursourcetypename]
TRUNCATE = 100

There are other ways to do this, but they require more processing, etc.

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...