Getting Data In

How to concatenate 2 fields to create a timestamp at import stage

virginiehang
New Member

Hello,

I need to import the below file:

<MessageEmissionDate>2017-12-04</MessageEmissionDate>
 <MessageEmissionTime>11:18:00 </MessageEmissionTime>

The timestamp should be the concatenation of Date and Time.... to be like 2017-12-04 11:18:00. How can I do that?

Tags (1)
0 Karma
1 Solution

adonio
Ultra Champion

hello there,

created small file with only the combination of the fields for timestamp and one line of data:

<MessageEmissionDate>2017-12-04</MessageEmissionDate>
 <MessageEmissionTime>11:18:00 </MessageEmissionTime>
<someData>data1</someData>
<MessageEmissionDate>2017-12-04</MessageEmissionDate>
 <MessageEmissionTime>12:18:00 </MessageEmissionTime>
<someData>data2</someData>
<MessageEmissionDate>2017-12-04</MessageEmissionDate>
 <MessageEmissionTime>13:18:00 </MessageEmissionTime>
<someData>data3</someData>
<MessageEmissionDate>2017-12-04</MessageEmissionDate>
 <MessageEmissionTime>14:18:00 </MessageEmissionTime>
<someData>data4</someData>

was able to extract correct timestamp with these props:

[ sourcetype_here ]
SHOULD_LINEMERGE=true
NO_BINARY_CHECK=true
MUST_BREAK_AFTER=</someData>
TIME_PREFIX=<MessageEmissionDate>

see screenshot below:

alt text

hope it helps

if it doesnt solve it, can you kindly provide sample data (full event/s)

View solution in original post

0 Karma

adonio
Ultra Champion

hello there,

created small file with only the combination of the fields for timestamp and one line of data:

<MessageEmissionDate>2017-12-04</MessageEmissionDate>
 <MessageEmissionTime>11:18:00 </MessageEmissionTime>
<someData>data1</someData>
<MessageEmissionDate>2017-12-04</MessageEmissionDate>
 <MessageEmissionTime>12:18:00 </MessageEmissionTime>
<someData>data2</someData>
<MessageEmissionDate>2017-12-04</MessageEmissionDate>
 <MessageEmissionTime>13:18:00 </MessageEmissionTime>
<someData>data3</someData>
<MessageEmissionDate>2017-12-04</MessageEmissionDate>
 <MessageEmissionTime>14:18:00 </MessageEmissionTime>
<someData>data4</someData>

was able to extract correct timestamp with these props:

[ sourcetype_here ]
SHOULD_LINEMERGE=true
NO_BINARY_CHECK=true
MUST_BREAK_AFTER=</someData>
TIME_PREFIX=<MessageEmissionDate>

see screenshot below:

alt text

hope it helps

if it doesnt solve it, can you kindly provide sample data (full event/s)

0 Karma

virginiehang
New Member

@adonio thanks for your help! it is ok on my side now!

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

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

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

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...