Getting Data In

Index events with timestamp of previous day

rajeshjlnt
Path Finder

We have a report from a system that needs to be indexed into splunk on monthly basis. This report is generated on 1st day of every month. 

Our requirement is to index events in this report on last day of previous month. So i want to index data from this report with timestamp of previous day.

Is this possible?

Labels (1)
0 Karma
1 Solution

rajeshjlnt
Path Finder

I added following in props.conf and transforms.conf to get the desired results,

transforms.conf

[timestamp-currenttime-oneday]
INGEST_EVAL = _time=time() - 86400

props.conf

[mysourcetype]
TRANSFORMS-gettime = timestamp-currenttime-oneday

 

 

View solution in original post

0 Karma

rajeshjlnt
Path Finder

I added following in props.conf and transforms.conf to get the desired results,

transforms.conf

[timestamp-currenttime-oneday]
INGEST_EVAL = _time=time() - 86400

props.conf

[mysourcetype]
TRANSFORMS-gettime = timestamp-currenttime-oneday

 

 

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

I'm not sure if I understood right your question, but you could get last month events by the next query:

index=_internal earliest=-1mon@mon latest=-0mon@mon
| stats earliest(_time) as eTime latest(_time) as lTime
| eval eTime = strftime(eTime, "%F %T %z"), lTime = strftime(lTime, "%F %T %z")
| table eTime lTime

To show reports day e.g. as last day of previous month just take day part of lTime (I suppose that you have events on it).

r. Ismo

0 Karma

rajeshjlnt
Path Finder

Thanks for your response @isoutamo , but my question is to manipulate timestamp during indexing events.

During event indexing there are settings in sourcetype like Auto, Current, Advanced and Configuration file. I would like to know if there is a way to set timestamp to be (current time - 1 day)

0 Karma

isoutamo
SplunkTrust
SplunkTrust
I haven't try this but there is INGEST_EVAL on transforms.conf (https://docs.splunk.com/Documentation/Splunk/8.1.0/Admin/Transformsconf) which can help you.
r. Ismo

rajeshjlnt
Path Finder

thanks @isoutamo for showing right direction

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...