Getting Data In

A very singular use case (I think) in indexing XML files.

tcmarquesi
Explorer

I think I have a very particular scenario using XML files. At least I did not find somebody having the same issue here. There we go!

I would like to index this XMLs where:
1. Each file is an entire event, there isn't event break inside the file.
2. Inside the file there isn't timestamp, only in the file name.

So:
1. Which sourcetype may I choose in this scenario? Should I create a custom one?
2. How can I make splunk identify the timestamp properly?

I'll thank very much if somebody can help me, very much.

Regards,

Tiago

Tags (3)
0 Karma
1 Solution

somesoni2
Revered Legend

You should create your own custom sourcetype to handle all the custom things that you want to do. Add a impossible to find Line breaker for your events so that all data from the file will appear as one event. It will be very inefficient to have Splunk read timestamp from the filename as there is no direct way to do that. Also, only the date can be extracted from file name, not the time. See this for more details on how to configure timestamp recognition in Splunk and what's the order Splunk follows.
http://docs.splunk.com/Documentation/Splunk/6.4.3/Data/HowSplunkextractstimestamps#How_Splunk_softwa...

I would suggest you to use the current time (time when Splunk sees the file and reads it) as the timestamp. If everything is working fine and your application is generating files with latest timestamp, then using current time will be the closest anyways. My suggestion would be like this

[YourSourceTypeName]
SHOULD_LINEMERGE = false
LINE_BREAKER =([\r\n]+)(?=YouWillNeverFindThisPattern)
DATETIME_CONFIG = current
TRUNCATE = 25000        #default to 10000 character, adjust based on your file content).
KV_MODE = xml

View solution in original post

0 Karma

somesoni2
Revered Legend

You should create your own custom sourcetype to handle all the custom things that you want to do. Add a impossible to find Line breaker for your events so that all data from the file will appear as one event. It will be very inefficient to have Splunk read timestamp from the filename as there is no direct way to do that. Also, only the date can be extracted from file name, not the time. See this for more details on how to configure timestamp recognition in Splunk and what's the order Splunk follows.
http://docs.splunk.com/Documentation/Splunk/6.4.3/Data/HowSplunkextractstimestamps#How_Splunk_softwa...

I would suggest you to use the current time (time when Splunk sees the file and reads it) as the timestamp. If everything is working fine and your application is generating files with latest timestamp, then using current time will be the closest anyways. My suggestion would be like this

[YourSourceTypeName]
SHOULD_LINEMERGE = false
LINE_BREAKER =([\r\n]+)(?=YouWillNeverFindThisPattern)
DATETIME_CONFIG = current
TRUNCATE = 25000        #default to 10000 character, adjust based on your file content).
KV_MODE = xml
0 Karma

tcmarquesi
Explorer

Thank you @somesoni2 🙂

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...