Splunk Search

How to add random month into event with only year

vgrand2
Explorer

Hi @links

I have event with future year 2021, 2022. I need to add random months into the years. Do you know which syntax can be used on this ?

Labels (1)
Tags (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Lacking more specifics about your use case, I offer this as an idea.

| eval month = (random()%12)+1
---
If this reply helps you, Karma would be appreciated.

View solution in original post

vgrand2
Explorer

Thanks @richgalloway . That is what I was looking for!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Lacking more specifics about your use case, I offer this as an idea.

| eval month = (random()%12)+1
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...