Splunk Search

how to set max column length

aaronkorn
Splunk Employee
Splunk Employee

What is the best possible function to limit a column to not exceed a specified character count or is there a way to word wrap to the next line after it has been reached?

0 Karma
1 Solution

jonuwz
Influencer

Yep.

Easiest was to make it a multivalued field.

... | rex field=longfield max_match=0 "(?<longfield>.{0,50})"

that'll split longfield into lines of no more that 50 characters.

View solution in original post

tv5
Engager

If you want to truncate a result column after certain length, use this...

| eval source = if (len(source) > 58, substr(source, 1, 55) + "...", source)

jonuwz
Influencer

Yep.

Easiest was to make it a multivalued field.

... | rex field=longfield max_match=0 "(?<longfield>.{0,50})"

that'll split longfield into lines of no more that 50 characters.

TonyLeeVT
Builder

This is an awesome solution, but it seems to take a long time to "Finalize" the search results for a large number of returned values.

Can we think of anything that is faster? Otherwise, it would be ideal if Splunk could just provide column width control without going to .css.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...