Getting Data In

Need to write a regex for time extraction

Praz_123
Communicator

Need to write a regex for  same as time and same as event given below in image 

Praz_123_0-1748407851980.png

 

Labels (3)
0 Karma

livehybrid
Super Champion

Hi @Praz_123 

Did the time extraction I provided in the previous thread not work for you for some reason?

livehybrid_0-1748413082590.png

 

TIME_PREFIX="ds":\s"
TIME_FORMAT=%Y-%m-%dT%H:%M:%S
MAX_TIMESTAMP_LOOKAHEAD=20

The reason for your error is the extra "." you have in your TIME_PREFIX which is causing it to skip the first character of the year. Also you need to specify the MAX_TIMESTAMP_LOOKAHEAD.

Below is my previous response incase you missed it.


@livehybrid wrote:
[yourSourceType]
SHOULD_LINEMERGE=false
LINE_BREAKER=([\S\s\n]+"predictions":\s\[\s*)|}(\s*\,\s*){|([\s\n\r]*\][\s\n\r]*}[\s\n\r]*)
NO_BINARY_CHECK=true
TIME_PREFIX="ds":\s"
TIME_FORMAT=%Y-%m-%dT%H:%M:%S
MAX_TIMESTAMP_LOOKAHEAD=20

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing


 

0 Karma

kiran_panchavat
Influencer

@Praz_123 

Let me try in my lab and get back to you shortly. 

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!
0 Karma

Praz_123
Communicator

@kiran_panchavat 

Same data would be like :-

{
"version": "200",
"predictions": [
{
"ds": "2023-01-01T01:00:00",
"y": 25727,
"yhat_lower": 23595.643771045987,
"yhat_upper": 26531.786203915904,
"marginal_upper": 26838.980030149163,
"marginal_lower": 23183.715141246714,
"anomaly": false
},
{
"ds": "2023-01-01T02:00:00",
"y": 24710,
"yhat_lower": 21984.478022195697,
"yhat_upper": 24966.416390280523,
"marginal_upper": 25457.020250925423,
"marginal_lower": 21744.743048120385,
"anomaly": false
},
{
"ds": "2023-01-01T03:00:00",
"y": 23908,
"yhat_lower": 21181.498740796877,
"yhat_upper": 24172.09825724038,
"marginal_upper": 24449.705257711226,
"marginal_lower": 20726.645610860345,
"anomaly": false
},

0 Karma

kiran_panchavat
Influencer

@Praz_123 

\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.000)?\b

kiran_panchavat_0-1748410424857.png

 

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!
0 Karma

Praz_123
Communicator

@kiran_panchavat 
am getting the error as I need the same date and time extraction while using the time format and time prefix am getting the below error 

Praz_123_1-1748410749785.png

 

Praz_123_0-1748410687455.png

Below is my props.conf 

[ _json ]
SHOULD_LINEMERGE=false
LINE_BREAKER=([\S\s\n]+"predictions":\s\[\s*)|}(\s*\,\s*){|([\s\n\r]*\][\s\n\r]*}[\s\n\r]*)
NO_BINARY_CHECK=true
TIME_FORMAT=%Y-%m-%dT%H:%M:%S
TIME_PREFIX=\[|ds\"\:\s\".

0 Karma

kiran_panchavat
Influencer

@Praz_123 

Check this

kiran_panchavat_0-1748411672686.png

 

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!
0 Karma

Praz_123
Communicator

@kiran_panchavat 

Not working for me are you using different event breaks and timestamp 

Praz_123_0-1748413042449.png


I used the below props.conf 

[ <SOURCETYPE NAME> ]
CHARSET=AUTO
SHOULD_LINEMERGE=true
LINE_BREAKER=([\r\n]+)
TIME_FORMAT=%Y-%m-%dT%H:%M:%S
TIME_PREFIX= "ds":\s*"

0 Karma

kiran_panchavat
Influencer

@Praz_123 

Check the data which you uploaded it should be .json format not .txt format. 

[ jsontest ]
CHARSET=UTF-8
LINE_BREAKER=([\S\s\n]+"predictions":\s\[\s*)|}(\s*\,\s*){|([\s\n\r]*\][\s\n\r]*}[\s\n\r]*)
NO_BINARY_CHECK=true
SHOULD_LINEMERGE=true
category=Custom
pulldown_type=true

kiran_panchavat_0-1748413533205.png

kiran_panchavat_2-1748413607591.png

 

kiran_panchavat_1-1748413578470.png

 

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!

Praz_123
Communicator

@kiran_panchavat 


Same issue again if I take in json or in txt both are not giving me results 

Praz_123_0-1748414362495.png

 

0 Karma

livehybrid
Super Champion

Hi @Praz_123 @kiran_panchavat 

You need to set MAX_DAYS_AGO=5000 and MAX_TIMESTAMP_LOOKAHEAD=20

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

0 Karma

kiran_panchavat
Influencer

@Praz_123 

Select source type something like, I can see it's showing default

********* Ignore this *****

Did this help? If yes, please consider giving kudos, marking it as the solution, or commenting for clarification — your feedback keeps the community going!
0 Karma

Praz_123
Communicator

@kiran_panchavat 

I got the answer thanks as I used the below props.conf  , @livehybrid  thanks for your help 

[ <SOURCETYPE NAME> ]
LINE_BREAKER=([\S\s\n]+"predictions":\s\[\s*)|}(\s*\,\s*){|([\s\n\r]*\][\s\n\r]*}[\s\n\r]*)
NO_BINARY_CHECK=true
TIME_FORMAT=%Y-%m-%dT%H:%M:%S
TIME_PREFIX="ds":\s"
MAX_TIMESTAMP_LOOKAHEAD=20
MAX_DAYS_AGO=5000

Get Updates on the Splunk Community!

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2025 SplunkTrust is officially open! If you ...

Splunk Answers Content Calendar, June Edition II

Get ready to dive into Splunk Dashboard panels this week! We'll be tackling common questions around ...

Splunk Observability Cloud's AI Assistant in Action Series: Auditing Compliance and ...

This is the third post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...