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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...