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!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...