Splunk Search

reducing metadata size

a212830
Champion

Hi,

I recall hearing at Splunk Conf2013 that it's a good idea to keep your metadata size reasonable. I process lots of logfiles which are in the format /apps/logs/YYYY/MM/DD/system-hostname.log. I'd like to change the source to be just the system-hostname.log, and eliminate the date. Is that possible? If so, how?

Tags (1)
0 Karma

gkanapathy
Splunk Employee
Splunk Employee

it's actually not as necessary as it was in earlier (say, 4.2 or earlier) versions of Splunk. also, it seems like you're only generating a new source name per day (rather than say, per-hour), which typically won't result in unmanageable metadata, even in the older versions in most cases. but yes, if you want to do it, or you're on an older version, or you have a more complex environment that results in a lot more source names, you can do an index-time transform.

e.g., transforms.conf:

[reduce-source-name]
SOURCE_KEY = MetaData::Source
REGEX = ([^\/\\]*)$
FORMAT = host::$1
DEST_KEY = MetaData::Source

(possibly the REGEX and FORMAT could be optimized for the specific path) and then something in props.conf to invoke the rule, e.g.,

[mysourcetype]
TRANSFORMS-sourcename = reduce-source-name

or

[source::/app/logs/*/*/*/system-*.log]
TRANSFORMS-sourcename = reduce-source-name
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...