Getting Data In

how to change timezone for splunk-add-onn for google cloud platform

jjofret
Explorer

hi, please i would like to ask for help to determine how to convert the timezone of events i am indexing with the gcp cloud plattform add-on before they are indexed. Events arrive today in UTC, and I need to convert that time to gmt-4. I have been trying from the sourcetype configuration, without success. I was also seeing this link, without much success

https://docs.splunk.com/Documentation/Splunk/8.2.1/Data/Applytimezoneoffsetstotimestamps

Labels (1)
Tags (1)
0 Karma

codebuilder
Influencer

When you say you need to convert that time, what do you mean exactly?

Events are stored using UTC at index time. At search time Splunk uses the time zone set on the Splunk instance (default time zone), unless a given user has changes that.

I think the latter is what you are after is displaying the correct time when searching. For this you don't need any conversion, just go to your user preferences and change your time zone to GMT. Splunk will then automatically adjust the results for you.

----
An upvote would be appreciated and Accept Solution if it helps!
0 Karma

jjofret
Explorer

Hi, this problem was resolved with this article:

 

https://docs.splunk.com/Documentation/Splunk/8.2.1/Data/Configuretimestamprecognition

 

thanks so much 

andrewcg
Path Finder

We are in EST and all data from Google in in UTC, so all of our data was four hours off:

 

index=<your gcp index> | 
eval indextime=strftime(_indextime,"%Y-%m-%d %H:%M:%S") | 
eval delta = _indextime - _time | 
table sourcetype, _time, _indextime, indextime, delta |
sort indextime desc

 

sourcetype _time indextime delta

google:gcp:pubsub:message2021-09-14 21:13:45.3812021-09-14 17:13:48-14397.381004
google:gcp:pubsub:message2021-09-14 21:13:47.2722021-09-14 17:13:47-14400.272801
google:gcp:pubsub:message2021-09-14 21:13:46.4302021-09-14 17:13:47-14399.43

 

jofret, is this the change you made? Edit file /opt/splunk/etc/apps/Splunk_TA_google-cloudplatform/local/props.conf

 

 

[google:billing:json]
TZ = UTC

[google:billing:csv]
TZ = UTC

[google:gcp:billing:report]
TZ = UTC

[google:gcp:pubsub:message]
TZ = UTC

[google:gcp:pubsub:audit:auth]
TZ = UTC

[google:gsuite:pubsub:audit:auth]
TZ = UTC

[google:gcp:gsuite:admin:directory:users]
TZ = UTC

[google:gcp:buckets:xmldata]
TZ = UTC

[google:gcp:buckets:jsondata]
TZ = UTC

[google:gcp:buckets:*data]
TZ = UTC

[google:gcp:compute:instance]
TZ = UTC

[google:gcp:compute:vpc_flows]
TZ = UTC

 

 

After refreshing the heavy forwarder this Splunk add is running on the the issue seems to be resolved.

sourcetype _time indextime delta

google:gcp:pubsub:message2021-09-14 17:20:38.1472021-09-14 17:20:390.852020
google:gcp:pubsub:message2021-09-14 17:20:38.1462021-09-14 17:20:390.853950
google:gcp:pubsub:message2021-09-14 17:20:38.0972021-09-14 17:20:390.902150
0 Karma
Get Updates on the Splunk Community!

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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

Get Inspired! We’ve Got Validation that Your Hard Work is Paying Off

We love our Splunk Community and want you to feel inspired by all your hard work! Eric Fusilero, our VP of ...