Getting Data In

How to write regex to create new events before a certain time format?

rameshlpatel
Communicator

Hi,

Please some help me to create new event if i find HH:MM:SS time format in logs for sourcetype perfLog.

I have used below configuration in props.conf file inside Indexer /opt/splunk/etc/system/local dir.

[sourcetype::perfLog]
SHOULD_LINEMERGE=false
BREAK_ONLY_BEFORE=^(?:\d|[01]\d|2[0-3]):[0-5]\d$

But still it did not work. Below are the example of logs.

08:11:13 |INFO | | LoggingHandler | ausu512a.wm.com|{http://esb.wm.com/service/getCustAccountInfo}getCustAccountInfo|getCustAccountInfo|329179|START TIME|Tue Aug 26 08:11:13 CDT 2014|Elapsed Time MS|244| MS |ESB CALL|TRANSACTION ID|2934447739687911190|
08:11:13 |DEBUG | | Profiler | ausu512a.wm.com|class com.wm.css.payment.dao.impl.PayTransactionDaoImpl|List com.wm.css.payment.dao.PayTransactionDao.getPaymentDetailsForAccount(String)|329179|START TIME|Tue Aug 26 08:11:13 CDT 2014|Elapsed Time MS|26| MS |
08:11:13 |DEBUG | | Profiler | ausu512a.wm.com|class com.wm.css.payment.service.impl.PaymentServiceImpl|List com.wm.css.payment.service.PaymentService.getPaymentDetailsForAccount(String)|329179|START TIME|Tue Aug 26 08:11:13 CDT 2014|Elapsed Time MS|26| MS |

0 Karma

somesoni2
Revered Legend

Try this

BREAK_ONLY_BEFORE=^\d{2}:\d{2}:\d{2}\s\|

0 Karma

Ayn
Legend

My advice would be to use www.regexr.com or similar to find a correct one 🙂 Otherwise I'd just help you this once and you wouldn't learn anything.

richgalloway
SplunkTrust
SplunkTrust

Try changing the BREAK_ONLY_BEFORE statement to 'LINE_BREAKER=([\r\n]+)(\d\d:\d\d:\d\d)'.

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

rameshlpatel
Communicator

Yes. I did

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Did you restart Splunk?

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

rameshlpatel
Communicator

Thanks but its not working.

0 Karma

rameshlpatel
Communicator

Help to create regex for same please ?

0 Karma

Ayn
Legend

Your regex isn't matching, so...

You're looking for ^(?:\d|[01]\d|2[0-3]):[0-5]\d$ and I don't see that matching anything in your sample events.

0 Karma
Get Updates on the Splunk Community!

Splunk Enterprise Security(ES) 7.3 is approaching the end of support. Get ready for ...

Hi friends!    At Splunk, your product success is our top priority. With Enterprise Security (ES), we're here ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...