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!

Full-Stack Security in Financial Services: AppDynamics, Cisco Secure Application, and ...

Full-Stack Security in Financial Services: AppDynamics, Cisco Secure Application, and Splunk ES Protecting a ...

It's Customer Success Time at .conf25

Hello Splunkers,   Ready for .conf25? The customer success and experience team is and can’t wait to see you ...

Pro Tips for First-Time .conf Attendees: Advice from SplunkTrust

Heading to your first .Conf? You’re in for an unforgettable ride — learning, networking, swag collecting, ...