Getting Data In

How to get the indexed stamp in the splunk logs

rishma
Explorer

Hi,

I have logs format like :
{"guid": "ABC", "type": "email", "value": "email", "session": "sessioid", "service": "HTTP", "created": "2019-11-07T22:41:28.682+00:00", "remote_host": "ip"}

I want to get the timestamp for indexing based on "created" field and want tp show it during search results under _time.

I used the below props.conf :
[sourcetype]
TIME_PREFIX = "created":\s"
KV_MODE=JSON
INDEXED_EXTRACTIONS=JSON
TZ=UTC
TIME_FORMAT=%Y-%m-%dT%H:%M:%S.%3N%z
MAX_TIMESTAMP_LOOKAHEAD = 1000

But its not working. Please guide.

Thanks,

Tags (1)
0 Karma

manjunathmeti
Champion

You can try just using TIMESTAMP_FIELDS, ignore other attributes (TIME_PREFIX, TZ, TIME_FORMAT, MAX_TIMESTAMP_LOOKAHEAD). And also attribute KV_MODE is not required during indexed time field extractions.

[sourcetype]
INDEXED_EXTRACTIONS = json
KV_MODE = none
TIMESTAMP_FIELDS = created
0 Karma

rishma
Explorer

Tried this too. But same response.

0 Karma

rishma
Explorer

Tried changing the entries to :

TIME_PREFIX=\"created\":\s\"
KV_MODE=JSON
INDEXED_EXTRACTIONS=JSON
TZ=UTC
TIME_FORMAT=%Y-%m-%dT%H:%M:%S.%3N%:z
MAX_TIMESTAMP_LOOKAHEAD = 100

as well as :

TIME_PREFIX="created":\s"
KV_MODE=JSON
INDEXED_EXTRACTIONS=JSON
TZ=UTC
TIME_FORMAT=%Y-%m-%dT%H:%M:%S.%3N%:z
MAX_TIMESTAMP_LOOKAHEAD = 100

and

TIME_PREFIX=\"created\":\s\"
KV_MODE=JSON
INDEXED_EXTRACTIONS=JSON
TZ=UTC
TIME_FORMAT=%Y-%m-%dT%H:%M:%S.%3N%z
MAX_TIMESTAMP_LOOKAHEAD = 100

None of the above worked.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try TIME_FORMAT=%Y-%m-%dT%H:%M:%S.%3N%:z

---
If this reply helps you, Karma would be appreciated.
0 Karma

rishma
Explorer

Tried it. But same response.

0 Karma

dflodstrom
Builder

Have you tried escaping the quotation marks in your TIME_PREFIX ?

TIME_PREFIX = \"created\":\s\"
0 Karma

rishma
Explorer

Tried it. Same response.

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!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...