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
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!

Splunk Add-on for Microsoft Windows 11.0.3: Parse Once, Search Faster

The updated Splunk Add-on for Microsoft Windows helps customers search Windows events faster by reducing ...

What's New in Splunk Enterprise Security 8.8 and Beyond

Threats move at machine speed. Keeping up should not depend on having the biggest budget, the largest team, or ...

A Four-Part Event Series: State of Observability - Where AI Meets Performance

As AI agents take on more complex tasks, teams need greater visibility into how they behave, what they cost, ...