Splunk Search

Remove square brackets from timestamp

jbesant
Explorer

Hi, hoping someone can help with this as its been a while since I used Splunk and I can't seem to figure this out!

I'm trying to import a csv that has a field with a time format of:

[20210102] 06:58.10

I have tried TIME_FORMAT=%Y%m%d %H:%M.%S

and I get a _time field that is correct except it doesn't show the seconds. the above is returned as 02/01/2021 06:58:00

I'm pretty sure its to do with the way the square brackets are being interpreted but can't seem to work out how to ignore them. Adding them into the TIME_FORMAT string doesn't help.

Thanks.

Labels (1)
Tags (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Include the brackets in the time format

TIME_PREFIX = \[
TIME_FORMAT = %Y%m%d] %H:%M.%S
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Include the brackets in the time format

TIME_PREFIX = \[
TIME_FORMAT = %Y%m%d] %H:%M.%S
---
If this reply helps you, Karma would be appreciated.

jbesant
Explorer

No, sorry, that doesn't work. I also tried TIME_PREFIX=^\[

0 Karma

richgalloway
SplunkTrust
SplunkTrust

How are you testing it?  If you're editing a props.conf file then be sure to restart Splunk afterwards.  Also, make sure to edit the correct file.

You know the settings only apply to new data, right?

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

jbesant
Explorer

Many thanks, forgot to do the restart.

0 Karma
Get Updates on the Splunk Community!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...