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!

Celebrating Fast Lane: 2025 Authorized Learning Partner of the Year

At .conf25, Splunk proudly recognized Fast Lane as the 2025 Authorized Learning Partner of the Year. This ...

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...