{"id":340438,"date":"2022-10-29T21:00:12","date_gmt":"2022-10-29T21:00:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=340438"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=340438","title":{"rendered":"<span>\u041f\u0440\u0438\u0442\u0447\u0430 \u043e \u0441\u0435\u043c\u0438 \u0441 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u043e\u0439 \u044f\u0437\u044b\u043a\u0430\u0445<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440.<\/h3>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0440\u0430\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445.<\/p>\n<h3>\u041a\u0430\u043a \u0432\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e\u0441\u044c<\/h3>\n<p>\u041b\u044e\u0431\u043e\u0439 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043b\u044e\u0431\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u0435\u0441\u0442 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u041a\u0430\u043a\u0430\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f \u043d\u0438\u0448\u0430 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u044f\u0447\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043b\u043e\u0433\u043e\u0432, \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438, \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c. <\/p>\n<p>\u0412\u043e\u0442 \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0438 \u043c\u043e\u0435\u0433\u043e \u043a\u043e\u043b\u043b\u0435\u0433\u0443 \u0443\u0442\u043e\u043c\u0438\u043b\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442\u044b \u043b\u043e\u0433\u043e\u0432 exchange \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u043f\u043e\u043b\u043d\u0435 \u0437\u0434\u0440\u0430\u0432\u0430\u044f \u043c\u044b\u0441\u043b\u044c \u043f\u043e\u0441\u0435\u0442\u0438\u043b\u0430 \u0435\u0433\u043e \u0441\u0432\u0435\u0442\u043b\u044b\u0439 \u0443\u043c \u2013 \u00ab\u041a\u0443\u0434\u0430 \u043a\u0430\u043a \u043f\u0440\u043e\u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043b\u0435\u0436\u0430\u0442 \u0432 \u043a\u0430\u043a\u043e\u0439 \u043d\u0438 \u0431\u0443\u0434\u044c \u0411\u0414\u00bb. \u0418 \u043d\u0435 \u043c\u0443\u0434\u0440\u0441\u0442\u0432\u0443\u044f \u043b\u0443\u043a\u0430\u0432\u043e \u043e\u043d \u043b\u0438\u0445\u043e \u043d\u0430\u0432\u0430\u044f\u043b \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0442\u043e\u043c \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043d\u0430 \u0435\u0433\u043e \u0441\u0432\u0435\u0436\u0435\u043d\u044c\u043a\u043e\u043c Linux. \u0422\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 python \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0441\u043a\u043b\u0430\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043b\u043e\u0433\u043e\u0432 \u0432 MongoDB.<\/p>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0432 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0435 \u0441\u043e \u043c\u043d\u043e\u0439 \u043e\u043d \u0432\u0441\u043a\u043e\u043b\u044c\u0437\u044c \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u043f\u0440\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0438 \u0438\u0437\u044a\u044f\u0432\u0438\u043b \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 JS. \u041c\u043d\u0435 \u043c\u044b\u0441\u043b\u044c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c, \u0438 \u044f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0432\u0441\u0435\u043c \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439. \u0427\u0435\u043c \u043c\u044b \u0438 \u0437\u0430\u043d\u044f\u043b\u0438\u0441\u044c \u0432 \u043e\u0431\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0440\u044b\u0432\u044b.<\/p>\n<h3>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 545 json \u0444\u0430\u043b\u0430 \u043e\u0431\u0449\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 1\u0413\u0431. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043d\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 687 \u0442\u044b\u0441\u044f\u0447. <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0411\u0414 \u0431\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 MongoDB.<\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 \u043b\u043e\u0433\u043e\u0432 exchange-\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u0442\u0443 \u0432 \u043a\u0430\u043a\u043e\u043c \u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u043c \u0432\u0438\u0434\u0435 (\u201cTimestamp\u201c:\u00a0 \u201c\\\/Date(1649404808029)\\\/\u201c), \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u0443 \u0437\u0430\u043f\u0438\u0441\u044c \u043a \u0442\u043e\u043c\u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 Mongo.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0435 \u201cMessageLatencyType\u201d \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043e\u0442 0, \u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f MessageLatency \u043d\u0430 MessageLatency. TotalMilliseconds.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u044d\u0442\u0438\u0445 \u043f\u043e\u043b\u0435\u0439:<\/p>\n<pre><code class=\"json\">\"MessageLatencyType\":  1  \"MessageLatency\":  {                                \"Days\":  0,                                \"Hours\":  0,                                \"Milliseconds\":  325,                                \"Minutes\":  0,                                \"Seconds\":  0,                                \"Ticks\":  3250000,                                \"TotalDays\":  3.7615740740740738E-06,                                \"TotalHours\":  9.0277777777777774E-05,                                \"TotalMilliseconds\":  325,                                \"TotalMinutes\":  0.0054166666666666669,                                \"TotalSeconds\":  0.325,                                \"Sign\":  1                            } <\/code><\/pre>\n<ul>\n<li>\n<p>\u0421\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0438\u043b\u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 JSON \u0438 Mongo.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0435\u0437 \u0447\u0438\u0442\u0435\u0440\u0441\u0442\u0432\u0430 )))<\/p>\n<\/li>\n<\/ul>\n<h3>\u0422\u0432\u043e\u0440\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h3>\n<p>\u0427\u0442\u043e \u0436\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0443 \u043d\u0430\u0441 \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439?<\/p>\n<h4>Python<\/h4>\n<p>\u0412 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u043f\u0438\u0442\u043e\u043d \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a\u0430\u043a \u0434\u043b\u044f \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0445 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0442\u0430\u043a \u0438  \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u044d\u0442\u043e\u0439. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f pymongo. <\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">def get_database():   from pymongo import MongoClient   import pymongo   CONNECTION_STRING = 'mongodb:\/\/localhost:27017'   client = MongoClient(CONNECTION_STRING)   return client['sample_database_python']   def convert_datetime(unix_timestamp):   import datetime   milliseconds = 0   if len(unix_timestamp) == 13:       milliseconds = int(unix_timestamp[-3:])       unix_timestamp = float(unix_timestamp[0:-3])   the_date = datetime.datetime.utcfromtimestamp(unix_timestamp)   the_date += datetime.timedelta(milliseconds=milliseconds)   return the_date   def import_file(file_name):   import json   with open(file_name, 'r', encoding='utf8') as  sample_file:     sample_data = json.load(sample_file)     for line in sample_data:       line['Timestamp'] = convert_datetime(line['Timestamp'][6:-2])       if (line['MessageLatencyType'] != 0):         line['MessageLatency'] = line['MessageLatency']['Milliseconds']     sample_collection.insert_many(sample_data)   if __name__ == '__main__':         database = get_database()  sample_collection = database['sample_collection']  import os path = '.\/data\/' for file in os.listdir(path):   if file.endswith('.json'):     import_file(f\"{path}{file}\")     # print(f\"Imported file: {path}{file}\") <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>JS<\/h4>\n<p>\u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0438 \u043e\u0447\u0435\u043d\u044c \u0448\u0443\u0441\u0442\u0440\u044b\u0439 \u044f\u0437\u044b\u043a. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0411\u0414 \u0438 \u0432\u043f\u0435\u0440\u0435\u0434.<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"javascript\">const { MongoClient } = require(\"mongodb\"); const client = new MongoClient(\"mongodb:\/\/127.0.0.1:27017\");  const fs = require(\"fs\"); \/\/ const path = \".\/data\/\"; const path = \"\/media\/user\/SOFT\/SHARED\/MX\/\";  async function run() {   try {     await client.connect();     const database = client.db(\"exchange_logs\");     const logsCollection = database.collection(\"records\");      const files = fs.readdirSync(path);     for (const file of files) {       await importFile(`${path}${file}`, logsCollection, database);       console.log(`Imported file: ${path}${file}`);     }   } catch (err) {     console.log(err);   } finally {     await client.close();   } }  async function importFile(fileName, logsCollection, database) {   try {     const sample_data = JSON.parse(fs.readFileSync(fileName, \"utf8\"));     sample_data.forEach((record) => {       record.Timestamp = new Date(+record.Timestamp.slice(6, 19));       if (record.MessageLatencyType !== 0) record.MessageLatency = record.MessageLatency.Milliseconds;     });     const results = await logsCollection.insertMany(sample_data);     \/\/ console.log(results);     await database.collection(\"logs\").insertOne({ FileName: fileName, Timestamp: new Date(), Success: true, InsertedCount: results.insertedCount });   } catch (error) {     await database.collection(\"logs\").insertOne({ FileName: fileName, Timestamp: new Date(), Success: false });   } }  run().catch(console.dir); <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>PowerShell 7,5<\/h4>\n<h4>5:<\/h4>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u043f\u043e\u0434 PS \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u0440\u0430\u0442\u044c \u0442\u043e \u0447\u0442\u043e \u0435\u0441\u0442\u044c: Install-Module Mdbc.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u043d\u043e\u0432\u044b\u0439, \u043d\u043e \u043e\u043d \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0441\u0442\u043e\u043b\u044c \u043d\u0443\u0436\u043d\u043e\u0433\u043e, \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430 \u043a\u0430\u043a InsertMany. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u00ab\u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0439\u00bb \u0437\u0430\u043f\u0438\u0441\u044c\u044e. \u042d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043d\u0443\u0436\u0434 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 JOSN \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c JavaScriptSerializer \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 System.Web.Script.Serialization.<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"powershell\">Import-Module Mdbc Add-Type -AssemblyName System.Web.Extensions  [string]$MongoUrl = \"mongodb:\/\/localhost:27017\" [string]$Db = \"sample_database_ps\" [string]$CollectionName = \"sample_collection_5\"  Connect-Mdbc $MongoUrl $Db $CollectionName  [string]$LogPath = \"c:\\temp\\data\"   $JS = New-Object System.Web.Script.Serialization.JavaScriptSerializer $JS.MaxJsonLength = 32108864  $Files = Get-ChildItem -Path $LogPath | Select-Object FullName  foreach ($File in $Files){     $StreamReader = New-Object System.IO.StreamReader($File.FullName)     $Content = $StreamReader.ReadToEnd()     $StreamReader.Dispose()      $JSON = $JS.DeserializeObject($Content)            foreach($Item in $JSON){         if($Item.MessageLatencyType -ne 0){             $Item.MessageLatency = $Item.MessageLatency.TotalMilliseconds          }      }       $JSON | Add-MdbcData  } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>7:<\/h4>\n<p>\u0421\u0435\u0434\u044c\u043c\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f PS \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0432\u0441\u0435\u043c\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u041d\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 \u0434\u043b\u044f JSON. \u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e-\u0442\u0430\u043a\u0438 \u043d\u0435\u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043b\u0438\u0432\u044b\u0439.   <\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"powershell\">Import-Module Mdbc [string]$MongoUrl = \"mongodb:\/\/localhost:27017\" [string]$Db = \"sample_database_ps\" [string]$CollectionName = \"sample_collection_7\"  Connect-Mdbc $MongoUrl $Db $CollectionName   [string]$LogPath = \"c:\\temp\\data\"  $Files = Get-ChildItem -Path $LogPath | Select-Object FullName  foreach ($File in $Files){         $Reader = New-Object System.IO.StreamReader($File.FullName)     $Content = $Reader.ReadToEnd()     $Reader.Dispose()      $JSON = $Content | ConvertFrom-Json # &lt;--- \u0412\u043e\u0442 \u043e\u043d            foreach($Item in $JSON){         if($Item.MessageLatencyType -ne 0){             $Item.MessageLatency = $Item.MessageLatency.TotalMilliseconds          }      }            $JSON | Add-MdbcData } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>GoLang<\/h4>\n<p>\u041f\u0440\u0438\u0437\u043d\u0430\u0442\u044c\u0441\u044f, \u044f \u0432\u043e\u0437\u043b\u0430\u0433\u0430\u043b \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043d\u0430\u0434\u0435\u0436\u0434\u044b \u043d\u0430 \u044d\u0442\u043e\u0442 \u044f\u0437\u044b\u043a. \u041d\u043e \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u043c\u044b \u043f\u043e\u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0435\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435. \u0410 \u043f\u043e\u043a\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"go\">package main  import ( \"encoding\/json\" \"fmt\" \"io\/ioutil\" \"log\" \"os\"  \"path\/filepath\" \"strconv\" \"time\"  \"context\"  \"go.mongodb.org\/mongo-driver\/mongo\" \"go.mongodb.org\/mongo-driver\/mongo\/options\" )  var collection *mongo.Collection var ctx = context.TODO()  func main() { DBinit() files := []string{}  files = GetFiles(\"c:\\\\temp\\\\data\") for _, item := range files { WorkJSON(item)  }  }  func GetFiles(Path string) []string { result := []string{} files, err := ioutil.ReadDir(Path) if err != nil { log.Fatal(err) }  for _, file := range files { s := filepath.Join(Path, file.Name()) result = append(result, s) } return result }  func WorkJSON(Path string) { jsonFile, err := os.Open(Path)  if err != nil { fmt.Println(err) }  byteValue, _ := ioutil.ReadAll(jsonFile)  jsonFile.Close()  var result []map[string]interface{} var docs = make([]interface{}, 0)  json.Unmarshal([]byte(byteValue), &amp;result)  for _, item := range result { if item[\"MessageLatencyType\"] != 0.0 { item[\"MessageLatency\"] = item[\"MessageLatency\"].(map[string]interface{})[\"TotalMilliseconds\"] }  var strjsonDate = item[\"Timestamp\"].(string)[6:19]  strDate, err := strconv.ParseInt(strjsonDate, 10, 64)  if err != nil { panic(err) } tm := time.Unix(strDate, 0)  item[\"Timestamp\"] = tm docs = append(docs, item)  }  collection.InsertMany(ctx, docs)  }  func DBinit() {  clientOptions := options.Client().ApplyURI(\"mongodb:\/\/localhost:27017\/\") client, err := mongo.Connect(ctx, clientOptions) if err != nil { log.Fatal(err) }  err = client.Ping(ctx, nil) if err != nil { log.Fatal(err) }  collection = client.Database(\"sample_database_node\").Collection(\"sample_collection_GO\") } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 Go \u043c\u0435\u043d\u044f \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u043e \u043f\u043e\u0441\u0435\u0442\u0438\u043b\u0430 \u043d\u043e\u0441\u0442\u0430\u043b\u044c\u0433\u0438\u044f. \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043b\u043e\u0441\u044c \u043a\u0430\u043a \u043e\u043a\u043e\u043b\u043e 25 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u043c\u0435\u043d\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u0438 \u0432 \u0437\u0430\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0432\u0430 \u043f\u0440\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 ))<\/p>\n<h4>Ruby<\/h4>\n<p>\u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0432 \u0440\u0443\u0431\u0438 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e. \u0418 \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e \u0447\u0442\u043e \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 \u0432\u0441\u0435 \u0432 \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a, \u043d\u0430 \u0440\u0443\u0431\u0438 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0444\u043e\u0440\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<p>\u0418 \u0442\u0430\u043a, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e gem install mongo \u0438 \u0432\u043f\u0435\u0440\u0435\u0434:<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"ruby\">class FilesHarvester     attr_reader :path, :Files     def initialize (path)          @path = path         self.GetFiles     end      def GetFiles         @Files = Dir.glob(path)     end end  class JSONWorker     attr_reader :path, :json_data     def initialize(path)         require 'json'         @path = path         json_file = File.open path         @json_data = JSON.load(json_file)          @json_data.each do |jsitem|             if (jsitem[\"MessageLatencyType\"] != 0)                 ts = jsitem[\"MessageLatency\"][\"TotalMilliseconds\"]                 jsitem[\"MessageLatency\"] = ts             end              raw_date = jsitem[\"Timestamp\"]             right_data = self.convert_time(raw_date)             jsitem[\"Timestamp\"] = right_data         end     end #init      def convert_time(raw_date)         require 'time'         clear_date = raw_date[6..-3].to_s         reult = DateTime.strptime(clear_date, '%Q')         return reult     end #convert_time end   class MongoDBClient     attr_reader :collection     def initialize         require 'mongo'         client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'sample_database_node')         db = client.database         @collection = client[:sample_collection_ruby]     end end   fileList = FilesHarvester.new(File.expand_path File.dirname(__FILE__) + '\/data\/*') #fileList = FilesHarvester.new('F:\/TEMP\/Ruby\/data_\/*') paths = fileList.Files  client = MongoDBClient.new  paths.each do |path|     jw = JSONWorker.new(path)     client.collection.insert_many(jw.json_data) end <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>C#<\/h4>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 Json \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f Newtonsoft \u0432\u0437\u044f\u0442\u044b\u0439 NuGet-\u043e\u043c. \u0414\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u043b\u044f Mongo \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435, \u0432\u0437\u044f\u0442\u044b \u043e\u0442\u0442\u0443\u0434\u0430 \u0436\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">using MongoDB.Bson;  using MongoDB.Bson.Serialization;  using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.IO;  using MongoDB.Driver;    namespace import_test_cs {     public class FilesWorker     {         public string[] files;         public FilesWorker(string Path)         {             files = Directory.GetFiles(Path, \"*.json\",                                          SearchOption.TopDirectoryOnly);          }     }     public class DBWorker     {         private string connectionString = \"mongodb:\/\/localhost:27017\";         private MongoClient client;         private IMongoCollection&lt;BsonDocument> DBCollection;          public DBWorker()         {             Setup();             BsonDocument chemp = new BsonDocument();         }          private void Setup()         {             client = new MongoClient(connectionString);             IMongoDatabase database = client.GetDatabase(\"sample_database_node\");             DBCollection = database.GetCollection&lt;BsonDocument>(\"sample_collection_cs\");         }           public void SaveManyDoc(List&lt;BsonDocument> bsonArray)         {             DBCollection.InsertMany(bsonArray);         }      }      class Program     {          static DateTime ConvertDateTime(string source)         {             DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);             dtDateTime = dtDateTime.AddMilliseconds(double.Parse(source));             return dtDateTime;         }          static void Main(string[] args)         {              string[] paths = new FilesWorker(@\"c:\/temp\/data\/\").files;              DBWorker DBClient = new DBWorker();               foreach (string path in paths)             {                 JArray JA1 = JArray.Parse(File.ReadAllText(path));                 List&lt;BsonDocument> Docs = new List&lt;BsonDocument>();                   foreach (var item in JA1)                 {                       if (item.Value&lt;int>(\"MessageLatencyType\") != 0)                     {                         var i = item.Value&lt;JObject>(\"MessageLatency\");                         item[\"MessageLatency\"] = i.Value&lt;int>(\"TotalMilliseconds\");                                              }                      BsonDocument BDoc = BsonSerializer.Deserialize&lt;BsonDocument>(item.ToString());                     string DB = BDoc.GetValue(\"Timestamp\").AsString;                     DateTime RealTime = DateTime.Parse(DB);                      BDoc.Remove(\"Timestamp\");                     BDoc.Add(new BsonElement(\"Timestamp\", RealTime));                      Docs.Add(BDoc);                 }                  DBClient.SaveManyDoc(Docs);             }           }     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>JAVA   <\/h4>\n<p>\u041a\u043e\u0434 \u043d\u0430 java \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u0430\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043c\u043d\u044b\u0439. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 json \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0430\u0441\u044c \u043b\u0435\u0433\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 com.github.cliftonlabs:json-simple<\/p>\n<details class=\"spoiler\">\n<summary>FileHarvester.java<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import java.util.ArrayList; import java.util.List; import java.io.File;  public class FileHarvester {     private File _Path;     public List&lt;String> Files;     public FileHarvester(String Path) {         File _Path = new File(Path);         this.Files = new ArrayList&lt;String>();         search(\".*\\\\.json\", _Path, Files);     }      public static void search(final String pattern, final File folder, List&lt;String> result) {         for (final File f : folder.listFiles()) {              if (f.isDirectory()) {                 search(pattern, f, result);             }              if (f.isFile()) {                 if (f.getName().matches(pattern)) {                     result.add(f.getAbsolutePath());                 }             }          }     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>DBClient.java<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import com.github.cliftonlabs.json_simple.JsonArray; import com.github.cliftonlabs.json_simple.JsonObject; import com.mongodb.client.MongoCollection; import org.bson.Document;  import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List;  public class DBClient {      private JsonArray JSON;     private MongoCollection collection;      public DBClient(JsonArray JSON, MongoCollection collection){         this.JSON = JSON;         this.collection = collection;          PutDate();     }      private void PutDate(){          List&lt;Document> jsonList = new ArrayList&lt;Document>();         for (Object Item: this.JSON) {              Document doc;\/\/= new Document();             String s = ((JsonObject)Item).toJson();             doc = Document.parse(s);             String d = doc.getString(\"Timestamp\");             LocalDateTime date = LocalDateTime.parse(d, DateTimeFormatter.ofPattern(\"yyyy-MM-dd HH:mm:ss.SSS\"));             doc.put(\"Timestamp\", date);             jsonList.add(doc);         }         this.collection.insertMany(jsonList);      }  } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>JSONWorker.java<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import com.github.cliftonlabs.json_simple.*;  import java.io.IOException; import java.io.Reader; import java.nio.file.Files; import java.nio.file.Paths; import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat;  import java.util.TimeZone;  public class JSONWorker {      public JsonArray JSON;     public String JSONString;     JSONWorker(String FilePath) throws IOException, JsonException {         Reader reader = Files.newBufferedReader(Paths.get(FilePath));          JsonArray TempJSON = (JsonArray) Jsoner.deserialize(reader);          for (Object Item: TempJSON) {             JsonKey Key = Jsoner.mintJsonKey(\"MessageLatencyType\", 0);              int i = ((JsonObject)Item).getInteger(Key);             if(i != 0)             {                 JsonKey KeyFromMountain = Jsoner.mintJsonKey(\"MessageLatency\", null);                 JsonObject MS =  ((JsonObject)Item).getMapOrDefault(KeyFromMountain);                  JsonKey KeyFromTotalMilliseconds = Jsoner.mintJsonKey(\"TotalMilliseconds\", 0);                 int TotalMilliseconds = MS.getInteger(KeyFromTotalMilliseconds);                  ((JsonObject)Item).put(\"MessageLatency\", TotalMilliseconds);              }              JsonKey DataKey = Jsoner.mintJsonKey(\"Timestamp\", 0);              String DataString = ((JsonObject)Item).getString(DataKey);             String ShortDataString = DataString.substring(6, 19);             long LongDataString = Long.parseLong(ShortDataString);             Timestamp ts = new Timestamp(LongDataString);              DateFormat df = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss.SSS\");             df.setTimeZone(TimeZone.getTimeZone(\"UTC\"));             String my8601formattedDate = df.format(ts);              ((JsonObject)Item).put(\"Timestamp\", my8601formattedDate);          } \/\/for          this.JSON = TempJSON;         this.JSONString = TempJSON.toJson();      }  } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>ImportTest.java<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">import com.github.cliftonlabs.json_simple.JsonException; import com.mongodb.MongoClient; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoDatabase;  import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths;  public class ImportTest {      public static void main(String[] args) throws JsonException, IOException {                 Path path = Paths.get(\"\");         String s = path.toAbsolutePath().toString();         String DataPath = s + File.separator + \"data\";         System.out.println(\"Data path:\" + DataPath);          FileHarvester FilesHarvest = new FileHarvester(DataPath);         MongoClient mongoClient = new MongoClient();         MongoDatabase database = mongoClient.getDatabase(\"sample_database_node\");         MongoCollection collection = database.getCollection(\"sample_collection_java\");          for (String FilePath : FilesHarvest.Files) {             JSONWorker JSONw = new JSONWorker(FilePath);             DBClient Mongo = new DBClient(JSONw.JSON, collection);          } \/\/for          mongoClient.close();       }  } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h3>\n<p>\u0418 \u0442\u0430\u043a. \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u0436\u0435 \u043c\u044b \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u043b\u0438?<\/p>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043d\u0438 \u0434\u043b\u044f \u0447\u0435\u0433\u043e ))). \u041f\u0440\u043e\u0441\u0442\u043e \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043b\u0435\u0433\u043a\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0431\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435, \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043d\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a. \u041f\u043e\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e, \u0438\u043b\u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0438\u043b\u0438 \u043a\u0440\u0430\u0441\u043e\u0442\u0443 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0439 \u043f\u0430\u043b\u0438\u0442\u0440\u044b, \u043d\u0443 \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440.<\/p>\n<p>\u041d\u043e \u043a\u043e\u043b\u044c \u0443\u0436 \u043c\u044b \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b\u0438 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0432\u043e\u0434\u044b. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f4b\/b54\/c49\/f4bb54c496842fa0e5f0062ed4e68a22.png\" width=\"670\" height=\"430\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f4b\/b54\/c49\/f4bb54c496842fa0e5f0062ed4e68a22.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0425\u043c\u2026 \u0427\u0442\u043e \u0436\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0430\u043a\u0443\u044e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438? <\/p>\n<p>\u0414\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043c\u044b \u0443\u0441\u043b\u043e\u0432\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0431\u043e\u0442\u0430 \u0441 JSON<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0411\u0414<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0432\u0435\u0441\u0438\u043b\u0438 \u043f\u043e \u0442\u0430\u0439\u043c\u0435\u0440\u0443 \u0438 \u0441\u0442\u0430\u043b\u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u0441\u0430\u043c\u044b\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 JSON. <\/p>\n<p>\u0417\u0430\u043c\u0435\u043d\u0430 \u0446\u0435\u043b\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 MessageLatency \u043d\u0430 \u043f\u043e\u043b\u0435 \u0442\u0438\u043f\u0430 int \u0441\u0430\u043c\u0430\u044f \u0434\u043e\u043b\u0433\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0432 \u043b\u044e\u0431\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 JSON, \u043a\u0440\u043e\u043c\u0435 JS. \u041d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e, \u043a\u0430\u043a JS \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 JSON, \u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u043e\u043d \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043d\u0438\u043c\u0438 \u043a\u0430\u043a \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<h3>P.S.:<\/h3>\n<p>\u0410 \u0432\u043e\u0442 \u0432\u043d\u0435\u043a\u043e\u043d\u043a\u0443\u0440\u0441\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Ruby.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a26\/4fd\/c10\/a264fdc10b9271956878aca92e052b64.png\" width=\"676\" height=\"400\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a26\/4fd\/c10\/a264fdc10b9271956878aca92e052b64.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0439 Ruby \u043e\u0431\u043e\u0448\u0435\u043b Go \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438. \u0425\u043e\u0442\u044f \u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0447\u0438\u0442\u0435\u0440\u0441\u0442\u0432\u043e, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u043e ))<\/p>\n<h3>\u041f\u0440\u043e\u0441\u0442\u043e \u043c\u044b\u0441\u043b\u0438 \u0432\u0441\u043b\u0443\u0445<\/h3>\n<p>\u041a\u0430\u043a \u044f \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435, \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0440\u0430\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445. \u0414\u0443\u043c\u0430\u044e, \u043e\u043d\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043b\u044f \u043b\u0435\u0433\u043a\u043e \u0447\u0442\u0438\u0432\u0430 \u043f\u043e\u0434 \u0447\u0430\u0448\u043a\u0443 \u0447\u0430\u044f. <\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u0441\u0442\u0438\u043d\u044b, \u0440\u043e\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0437\u044b\u0432\u0430 \u043a \u0432\u044b\u0431\u043e\u0440\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. <\/p>\n<p>\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u044f, \u0442\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0442\u043e \u0447\u0442\u043e \u0434\u0430\u0432\u043d\u043e \u0445\u043e\u0442\u0435\u043b &#8212; \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b Ruby \u0438 Go, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043f\u043e \u043f\u0440\u0438\u0441\u0442\u0430\u043b\u044c\u043d\u0435\u0439 \u043d\u0430 Java. Ruby \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0443 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u043d\u0438\u043c. \u041c\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0440\u0430\u0431\u043e\u0442\u044b (PS7) \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0432 \u0442\u043e\u043f\u0435, \u0436\u0430\u043b\u043a\u043e \u0447\u0442\u043e \u0441 \u043a\u043e\u043d\u0446\u0430 \ud83d\ude42<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043a\u043e\u043c\u0443-\u0442\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \ud83d\ude42<\/p>\n<p>\u0412\u0441\u0435\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/696246\/\"> https:\/\/habr.com\/ru\/post\/696246\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440.<\/h3>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0440\u0430\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445.<\/p>\n<h3>\u041a\u0430\u043a \u0432\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e\u0441\u044c<\/h3>\n<p>\u041b\u044e\u0431\u043e\u0439 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043b\u044e\u0431\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e \u043c\u0435\u0441\u0442 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u041a\u0430\u043a\u0430\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f \u043d\u0438\u0448\u0430 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u044f\u0447\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043b\u043e\u0433\u043e\u0432, \u0441\u0431\u043e\u0440\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438, \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c. <\/p>\n<p>\u0412\u043e\u0442 \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u0438 \u043c\u043e\u0435\u0433\u043e \u043a\u043e\u043b\u043b\u0435\u0433\u0443 \u0443\u0442\u043e\u043c\u0438\u043b\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442\u044b \u043b\u043e\u0433\u043e\u0432 exchange \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u043f\u043e\u043b\u043d\u0435 \u0437\u0434\u0440\u0430\u0432\u0430\u044f \u043c\u044b\u0441\u043b\u044c \u043f\u043e\u0441\u0435\u0442\u0438\u043b\u0430 \u0435\u0433\u043e \u0441\u0432\u0435\u0442\u043b\u044b\u0439 \u0443\u043c \u2013 \u00ab\u041a\u0443\u0434\u0430 \u043a\u0430\u043a \u043f\u0440\u043e\u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043b\u0435\u0436\u0430\u0442 \u0432 \u043a\u0430\u043a\u043e\u0439 \u043d\u0438 \u0431\u0443\u0434\u044c \u0411\u0414\u00bb. \u0418 \u043d\u0435 \u043c\u0443\u0434\u0440\u0441\u0442\u0432\u0443\u044f \u043b\u0443\u043a\u0430\u0432\u043e \u043e\u043d \u043b\u0438\u0445\u043e \u043d\u0430\u0432\u0430\u044f\u043b \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0442\u043e\u043c \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u043d\u0430 \u0435\u0433\u043e \u0441\u0432\u0435\u0436\u0435\u043d\u044c\u043a\u043e\u043c Linux. \u0422\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 python \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u043b\u0441\u044f \u0441\u043a\u043b\u0430\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043b\u043e\u0433\u043e\u0432 \u0432 MongoDB.<\/p>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0432 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0435 \u0441\u043e \u043c\u043d\u043e\u0439 \u043e\u043d \u0432\u0441\u043a\u043e\u043b\u044c\u0437\u044c \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b \u043f\u0440\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0438 \u0438\u0437\u044a\u044f\u0432\u0438\u043b \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430 JS. \u041c\u043d\u0435 \u043c\u044b\u0441\u043b\u044c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c, \u0438 \u044f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0432\u0441\u0435\u043c \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439. \u0427\u0435\u043c \u043c\u044b \u0438 \u0437\u0430\u043d\u044f\u043b\u0438\u0441\u044c \u0432 \u043e\u0431\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0440\u044b\u0432\u044b.<\/p>\n<h3>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 545 json \u0444\u0430\u043b\u0430 \u043e\u0431\u0449\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 1\u0413\u0431. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043d\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 687 \u0442\u044b\u0441\u044f\u0447. <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0411\u0414 \u0431\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 MongoDB.<\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0435\u0440 \u043b\u043e\u0433\u043e\u0432 exchange-\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u0442\u0443 \u0432 \u043a\u0430\u043a\u043e\u043c \u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u043c \u0432\u0438\u0434\u0435 (\u201cTimestamp\u201c:\u00a0 \u201c\\\/Date(1649404808029)\\\/\u201c), \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u044d\u0442\u0443 \u0437\u0430\u043f\u0438\u0441\u044c \u043a \u0442\u043e\u043c\u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442 Mongo.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0435 \u201cMessageLatencyType\u201d \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043e\u0442 0, \u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f MessageLatency \u043d\u0430 MessageLatency. TotalMilliseconds.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u044d\u0442\u0438\u0445 \u043f\u043e\u043b\u0435\u0439:<\/p>\n<pre><code class=\"json\">\"MessageLatencyType\":  1  \"MessageLatency\":  {                                \"Days\":  0,                                \"Hours\":  0,                                \"Milliseconds\":  325,                                \"Minutes\":  0,                                \"Seconds\":  0,                                \"Ticks\":  3250000,                                \"TotalDays\":  3.7615740740740738E-06,                                \"TotalHours\":  9.0277777777777774E-05,                                \"TotalMilliseconds\":  325,                                \"TotalMinutes\":  0.0054166666666666669,                                \"TotalSeconds\":  0.325,                                \"Sign\":  1                            } <\/code><\/pre>\n<ul>\n<li>\n<p>\u0421\u0442\u0430\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0438\u043b\u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 JSON \u0438 Mongo.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0435\u0437 \u0447\u0438\u0442\u0435\u0440\u0441\u0442\u0432\u0430 )))<\/p>\n<\/li>\n<\/ul>\n<h3>\u0422\u0432\u043e\u0440\u0447\u0435\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/h3>\n<p>\u0427\u0442\u043e \u0436\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0443 \u043d\u0430\u0441 \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439?<\/p>\n<h4>Python<\/h4>\n<p>\u0412 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u043f\u0438\u0442\u043e\u043d \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043a\u0430\u043a \u0434\u043b\u044f \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0445 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0442\u0430\u043a \u0438  \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u044d\u0442\u043e\u0439. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f pymongo. <\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">def get_database():   from pymongo import MongoClient   import pymongo   CONNECTION_STRING = 'mongodb:\/\/localhost:27017'   client = MongoClient(CONNECTION_STRING)   return client['sample_database_python']   def convert_datetime(unix_timestamp):   import datetime   milliseconds = 0   if len(unix_timestamp) == 13:       milliseconds = int(unix_timestamp[-3:])       unix_timestamp = float(unix_timestamp[0:-3])   the_date = datetime.datetime.utcfromtimestamp(unix_timestamp)   the_date += datetime.timedelta(milliseconds=milliseconds)   return the_date   def import_file(file_name):   import json   with open(file_name, 'r', encoding='utf8') as  sample_file:     sample_data = json.load(sample_file)     for line in sample_data:       line['Timestamp'] = convert_datetime(line['Timestamp'][6:-2])       if (line['MessageLatencyType'] != 0):         line['MessageLatency'] = line['MessageLatency']['Milliseconds']     sample_collection.insert_many(sample_data)   if __name__ == '__main__':         database = get_database()  sample_collection = database['sample_collection']  import os path = '.\/data\/' for file in os.listdir(path):   if file.endswith('.json'):     import_file(f\"{path}{file}\")     # print(f\"Imported file: {path}{file}\") <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>JS<\/h4>\n<p>\u041f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0438 \u043e\u0447\u0435\u043d\u044c \u0448\u0443\u0441\u0442\u0440\u044b\u0439 \u044f\u0437\u044b\u043a. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0411\u0414 \u0438 \u0432\u043f\u0435\u0440\u0435\u0434.<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"javascript\">const { MongoClient } = require(\"mongodb\"); const client = new MongoClient(\"mongodb:\/\/127.0.0.1:27017\");  const fs = require(\"fs\"); \/\/ const path = \".\/data\/\"; const path = \"\/media\/user\/SOFT\/SHARED\/MX\/\";  async function run() {   try {     await client.connect();     const database = client.db(\"exchange_logs\");     const logsCollection = database.collection(\"records\");      const files = fs.readdirSync(path);     for (const file of files) {       await importFile(`${path}${file}`, logsCollection, database);       console.log(`Imported file: ${path}${file}`);     }   } catch (err) {     console.log(err);   } finally {     await client.close();   } }  async function importFile(fileName, logsCollection, database) {   try {     const sample_data = JSON.parse(fs.readFileSync(fileName, \"utf8\"));     sample_data.forEach((record) => {       record.Timestamp = new Date(+record.Timestamp.slice(6, 19));       if (record.MessageLatencyType !== 0) record.MessageLatency = record.MessageLatency.Milliseconds;     });     const results = await logsCollection.insertMany(sample_data);     \/\/ console.log(results);     await database.collection(\"logs\").insertOne({ FileName: fileName, Timestamp: new Date(), Success: true, InsertedCount: results.insertedCount });   } catch (error) {     await database.collection(\"logs\").insertOne({ FileName: fileName, Timestamp: new Date(), Success: false });   } }  run().catch(console.dir); <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>PowerShell 7,5<\/h4>\n<h4>5:<\/h4>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u043f\u043e\u0434 PS \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0431\u0440\u0430\u0442\u044c \u0442\u043e \u0447\u0442\u043e \u0435\u0441\u0442\u044c: Install-Module Mdbc.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u043d\u043e\u0432\u044b\u0439, \u043d\u043e \u043e\u043d \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0441\u0442\u043e\u043b\u044c \u043d\u0443\u0436\u043d\u043e\u0433\u043e, \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430 \u043a\u0430\u043a InsertMany. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u00ab\u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u043e\u0439\u00bb \u0437\u0430\u043f\u0438\u0441\u044c\u044e. \u042d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043d\u0443\u0436\u0434 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 JOSN \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c JavaScriptSerializer \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 System.Web.Script.Serialization.<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"powershell\">Import-Module Mdbc Add-Type -AssemblyName System.Web.Extensions  [string]$MongoUrl = \"mongodb:\/\/localhost:27017\" [string]$Db = \"sample_database_ps\" [string]$CollectionName = \"sample_collection_5\"  Connect-Mdbc $MongoUrl $Db $CollectionName  [string]$LogPath = \"c:\\temp\\data\"   $JS = New-Object System.Web.Script.Serialization.JavaScriptSerializer $JS.MaxJsonLength = 32108864  $Files = Get-ChildItem -Path $LogPath | Select-Object FullName  foreach ($File in $Files){     $StreamReader = New-Object System.IO.StreamReader($File.FullName)     $Content = $StreamReader.ReadToEnd()     $StreamReader.Dispose()      $JSON = $JS.DeserializeObject($Content)            foreach($Item in $JSON){         if($Item.MessageLatencyType -ne 0){             $Item.MessageLatency = $Item.MessageLatency.TotalMilliseconds          }      }       $JSON | Add-MdbcData  } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>7:<\/h4>\n<p>\u0421\u0435\u0434\u044c\u043c\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f PS \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0432\u0441\u0435\u043c\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u041d\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 \u0434\u043b\u044f JSON. \u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e-\u0442\u0430\u043a\u0438 \u043d\u0435\u043f\u043e\u0432\u043e\u0440\u043e\u0442\u043b\u0438\u0432\u044b\u0439.   <\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"powershell\">Import-Module Mdbc [string]$MongoUrl = \"mongodb:\/\/localhost:27017\" [string]$Db = \"sample_database_ps\" [string]$CollectionName = \"sample_collection_7\"  Connect-Mdbc $MongoUrl $Db $CollectionName   [string]$LogPath = \"c:\\temp\\data\"  $Files = Get-ChildItem -Path $LogPath | Select-Object FullName  foreach ($File in $Files){         $Reader = New-Object System.IO.StreamReader($File.FullName)     $Content = $Reader.ReadToEnd()     $Reader.Dispose()      $JSON = $Content | ConvertFrom-Json # &lt;--- \u0412\u043e\u0442 \u043e\u043d            foreach($Item in $JSON){         if($Item.MessageLatencyType -ne 0){             $Item.MessageLatency = $Item.MessageLatency.TotalMilliseconds          }      }            $JSON | Add-MdbcData } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h4>GoLang<\/h4>\n<p>\u041f\u0440\u0438\u0437\u043d\u0430\u0442\u044c\u0441\u044f, \u044f \u0432\u043e\u0437\u043b\u0430\u0433\u0430\u043b \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043d\u0430\u0434\u0435\u0436\u0434\u044b \u043d\u0430 \u044d\u0442\u043e\u0442 \u044f\u0437\u044b\u043a. \u041d\u043e \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u043c\u044b \u043f\u043e\u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0435\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435. \u0410 \u043f\u043e\u043a\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"go\">package main  import ( \"encoding\/json\" \"fmt\" \"io\/ioutil\" \"log\" \"os\"  \"path\/filepath\" \"strconv\" \"time\"  \"context\"  \"go.mongodb.org\/mongo-driver\/mongo\" \"go.mongodb.org\/mongo-driver\/mongo\/options\" )  var collection *mongo.Collection var ctx = context.TODO()  func main() { DBinit() files := []string{}  files = GetFiles(\"c:\\\\temp\\\\data\") for _, item := range files { WorkJSON(item)  }  }  func GetFiles(Path string) []string { result := []string{} files, err := ioutil.ReadDir(Path) if err != nil { log.Fatal(err) }  for _, file := range files { s := filepath.Join(Path, file.Name()) result = append(result, s) } return result }  func WorkJSON(Path string) { jsonFile, err := os.Open(Path)  if err != nil { fmt.Println(err) }  byteValue, _ := ioutil.ReadAll(jsonFile)  jsonFile.Close()  var result []map[string]interface{} var docs = make([]interface{}, 0)  json.Unmarshal([]byte(byteValue), &amp;result)  for _, item := range result { if item[\"MessageLatencyType\"] != 0.0 { item[\"MessageLatency\"] = item[\"MessageLatency\"].(map[string]interface{})[\"TotalMilliseconds\"] }  var strjsonDate = item[\"Timestamp\"].(string)[6:19]  strDate, err := strconv.ParseInt(strjsonDate, 10, 64)  if err != nil { panic(err) } tm := time.Unix(strDate, 0)  item[\"Timestamp\"] = tm docs = append(docs, item)  }  collection.InsertMany(ctx, docs)  }  func DBinit() {  clientOptions := options.Client().ApplyURI(\"mongodb:\/\/localhost:27017\/\") client, err := mongo.Connect(ctx, clientOptions) if err != nil { log.Fatal(err) }  err = client.Ping(ctx, nil) if err != nil { log.Fatal(err) }  collection = client.Database(\"sample_database_node\").Collection(\"sample_collection_GO\") } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 Go \u043c\u0435\u043d\u044f \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u043e \u043f\u043e\u0441\u0435\u0442\u0438\u043b\u0430 \u043d\u043e\u0441\u0442\u0430\u043b\u044c\u0433\u0438\u044f. \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043b\u043e\u0441\u044c \u043a\u0430\u043a \u043e\u043a\u043e\u043b\u043e 25 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u043c\u0435\u043d\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u0438 \u0432 \u0437\u0430\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0432\u0430 \u043f\u0440\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 ))<\/p>\n<h4>Ruby<\/h4>\n<p>\u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0432 \u0440\u0443\u0431\u0438 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e. \u0418 \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e \u0447\u0442\u043e \u0432 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043c\u044b \u0434\u0435\u043b\u0430\u043b\u0438 \u0432\u0441\u0435 \u0432 \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a, \u043d\u0430 \u0440\u0443\u0431\u0438 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0444\u043e\u0440\u043a \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<p>\u0418 \u0442\u0430\u043a, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0440\u043e gem install mongo \u0438 \u0432\u043f\u0435\u0440\u0435\u0434:<\/p>\n<details class=\"spoiler\">\n<summary>Hidden text<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"ruby\">class FilesHarvester     attr_reader :path, :Files     def initialize (path)          @path = path         self.GetFiles     end      def GetFiles         @Files = Dir.glob(path)     end end  class JSONWorker     attr_reader :path, :json_data     def <\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-340438","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/340438","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=340438"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/340438\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=340438"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=340438"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=340438"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}