Hi gargee!
To use mongoimport a file that is in csv, tsv, or json must be provided. Using a script to preprocess what is provided above into csv is a good approach. It is possible to use a script to generically break those into key value pairs before and after the equal sign (assuming the rest of the data also is in that form). Inserting them into an array of key-value pairs should work (if you have a massive numbers of key-value pairs this could incur performance issues and/or the max document size (16 meg in 2.4)). A document in the database with this solution would look like this:
{ src_ip: "120.0.8.127", src_country_code: "USA", ...<common fields>, log_type="FTP", kv: [{key:"ExchangeSpecific", value:"Over"}, […<specific fields>]}
However, having a different data model might also work. One of mongo's strengths is that it can have different fields in different records. If the conversion script made document fields instead of a key-value pair array then you would have much easier to use document.
With this approach simply insert the document as it appears naturally (this might take some mental adjusting to how simple it is after years of RDBMS complications):
{ src_ip: "120.0.8.127", src_country_code: "USA", ...<common fields>, log_type="FTP", ExchangeSpecific: "Over"}, ...<specific fields>}
Listing common and specific fields above is over kill for illustration as all fields are at the document level.
If you have any questions please don’t hesitate to ask.
Best,
Charlie
Thanks,
grajee