Splunk Search

Character format conversion

jcisha
Path Finder

I search characters in the format you want to convert.

Characters in the form of six-digit "0" "000000" and want to convert to.
ex)
Source: "1", convert: "000001"
Source: "2", convert: "000002"

Many ways tried to think, but can not get the results.
Please help me.

0 Karma

erick_costa
Path Finder

Hi,

This should help:

| eval y = tostring( Source ) | eval x="00000" | strcat x "0" y z | eval w=substr(z, -6) | table w

jcisha
Path Finder

Thank you, and I want to solve the problem.
Use the Format function if it would have been better.

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...