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!

Your Feedback. Our Roadmap. Visit the PX Feedback Booth at .conf26

You use Splunk every day, come and help shape what's next.  Save Your Seat: Product-Focused Sessions at ...

Agentic SOC Triage: Investigating Splunk ES Notables with MCP Server and a Local LLM

The Problem: Too Many Alerts, Too Little Context Security operations teams running Splunk Enterprise Security ...

Painting a Clearer Picture: Creating Cross-Domain Visibility with AI Canvas

Watch Now Painting a Clearer Picture: Creating Cross-Domain Visibility with AI Canvas     Do you ever feel ...