1
0
mirror of https://github.com/romanlryji/EventLogLoader.git synced 2024-11-24 08:32:52 +02:00

Merge pull request #15 from alekseybochkov/PR13

PR13 - transaction properties and index postfix
This commit is contained in:
Alexey Bochkov 2017-04-15 16:38:55 -07:00 committed by GitHub
commit 2f830f19af
6 changed files with 204 additions and 67 deletions

View File

@ -130,9 +130,6 @@
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="EventLogLoaderDebug_1_TemporaryKey.pfx" />
<None Include="EventLogLoaderDebug_2_TemporaryKey.pfx" />
<None Include="EventLogLoaderDebug_TemporaryKey.pfx" />
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>

View File

@ -30,10 +30,10 @@ Partial Class Form1
Me.IBEvLogSize = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.InfobaseLogPath = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ESServerName = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.StartAt = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.ConnectionStringBox = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button4 = New System.Windows.Forms.Button()
Me.Label3 = New System.Windows.Forms.Label()
Me.ESIndexNameTextBox = New System.Windows.Forms.TextBox()
Me.DBType = New System.Windows.Forms.ComboBox()
Me.Button6 = New System.Windows.Forms.Button()
@ -45,14 +45,17 @@ Partial Class Form1
Me.Button2 = New System.Windows.Forms.Button()
Me.RepeatTime = New System.Windows.Forms.TextBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.LinkLabel2 = New System.Windows.Forms.LinkLabel()
Me.LinkLabel1 = New System.Windows.Forms.LinkLabel()
Me.LinkLabel3 = New System.Windows.Forms.LinkLabel()
Me.Label5 = New System.Windows.Forms.Label()
Me.UseSynonymsForFieldsNamesCheckBox = New System.Windows.Forms.CheckBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.StartAt = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.LabelIndexNameExample = New System.Windows.Forms.Label()
Me.CheckBoxSplitIndexByPeriods = New System.Windows.Forms.CheckBox()
Me.ComboBoxESIndexPostfix = New System.Windows.Forms.ComboBox()
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.SuspendLayout()
'
'ListView
@ -64,7 +67,7 @@ Partial Class Form1
Me.ListView.GridLines = True
Me.ListView.Location = New System.Drawing.Point(3, 20)
Me.ListView.Name = "ListView"
Me.ListView.Size = New System.Drawing.Size(746, 327)
Me.ListView.Size = New System.Drawing.Size(746, 273)
Me.ListView.TabIndex = 1
Me.ListView.UseCompatibleStateImageBehavior = False
Me.ListView.View = System.Windows.Forms.View.Details
@ -104,6 +107,11 @@ Partial Class Form1
Me.ESServerName.Text = "Имя сервера для ES"
Me.ESServerName.Width = 180
'
'StartAt
'
Me.StartAt.Text = "Начальная дата"
Me.StartAt.Width = 150
'
'ConnectionStringBox
'
Me.ConnectionStringBox.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
@ -116,11 +124,11 @@ Partial Class Form1
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Tahoma", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
Me.Label1.Font = New System.Drawing.Font("Tahoma", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
Me.Label1.ForeColor = System.Drawing.Color.Maroon
Me.Label1.Location = New System.Drawing.Point(4, 4)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(450, 17)
Me.Label1.Size = New System.Drawing.Size(402, 17)
Me.Label1.TabIndex = 3
Me.Label1.Text = "Строка соединения с базой данных для записи событий ЖР"
'
@ -134,24 +142,11 @@ Partial Class Form1
Me.Button4.Text = "Проверить"
Me.Button4.UseVisualStyleBackColor = True
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Font = New System.Drawing.Font("Tahoma", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
Me.Label3.ForeColor = System.Drawing.Color.Maroon
Me.Label3.Location = New System.Drawing.Point(4, 74)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(197, 17)
Me.Label3.TabIndex = 10
Me.Label3.Text = "Имя индекса ElasticSearch"
'
'ESIndexNameTextBox
'
Me.ESIndexNameTextBox.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.ESIndexNameTextBox.Location = New System.Drawing.Point(449, 74)
Me.ESIndexNameTextBox.Location = New System.Drawing.Point(107, 21)
Me.ESIndexNameTextBox.Name = "ESIndexNameTextBox"
Me.ESIndexNameTextBox.Size = New System.Drawing.Size(156, 20)
Me.ESIndexNameTextBox.Size = New System.Drawing.Size(169, 24)
Me.ESIndexNameTextBox.TabIndex = 9
'
'DBType
@ -182,11 +177,11 @@ Partial Class Form1
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.GroupBox1.Controls.Add(Me.ListView)
Me.GroupBox1.Font = New System.Drawing.Font("Tahoma", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
Me.GroupBox1.Font = New System.Drawing.Font("Tahoma", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
Me.GroupBox1.ForeColor = System.Drawing.Color.Maroon
Me.GroupBox1.Location = New System.Drawing.Point(4, 100)
Me.GroupBox1.Location = New System.Drawing.Point(4, 154)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(752, 350)
Me.GroupBox1.Size = New System.Drawing.Size(752, 296)
Me.GroupBox1.TabIndex = 5
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Обнаруженные информационные базы 1С"
@ -194,11 +189,11 @@ Partial Class Form1
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("Tahoma", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
Me.Label2.Font = New System.Drawing.Font("Tahoma", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(204, Byte))
Me.Label2.ForeColor = System.Drawing.Color.Maroon
Me.Label2.Location = New System.Drawing.Point(4, 49)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(439, 17)
Me.Label2.Size = New System.Drawing.Size(389, 17)
Me.Label2.TabIndex = 3
Me.Label2.Text = "Интервал между циклами чтения событий из ЖР (секунд)"
'
@ -273,17 +268,6 @@ Partial Class Form1
Me.Label4.TabIndex = 22
Me.Label4.Text = "Описание и страница для обратной связи:"
'
'LinkLabel2
'
Me.LinkLabel2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.LinkLabel2.AutoSize = True
Me.LinkLabel2.Location = New System.Drawing.Point(662, 530)
Me.LinkLabel2.Name = "LinkLabel2"
Me.LinkLabel2.Size = New System.Drawing.Size(102, 13)
Me.LinkLabel2.TabIndex = 20
Me.LinkLabel2.TabStop = True
Me.LinkLabel2.Text = "© Aleksey.Bochkov"
'
'LinkLabel1
'
Me.LinkLabel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
@ -319,39 +303,81 @@ Partial Class Form1
'UseSynonymsForFieldsNamesCheckBox
'
Me.UseSynonymsForFieldsNamesCheckBox.AutoSize = True
Me.UseSynonymsForFieldsNamesCheckBox.Location = New System.Drawing.Point(611, 77)
Me.UseSynonymsForFieldsNamesCheckBox.ForeColor = System.Drawing.Color.Black
Me.UseSynonymsForFieldsNamesCheckBox.Location = New System.Drawing.Point(13, 50)
Me.UseSynonymsForFieldsNamesCheckBox.Name = "UseSynonymsForFieldsNamesCheckBox"
Me.UseSynonymsForFieldsNamesCheckBox.Size = New System.Drawing.Size(15, 14)
Me.UseSynonymsForFieldsNamesCheckBox.Size = New System.Drawing.Size(237, 21)
Me.UseSynonymsForFieldsNamesCheckBox.TabIndex = 23
Me.UseSynonymsForFieldsNamesCheckBox.Text = "Использовать свои имена полей"
Me.UseSynonymsForFieldsNamesCheckBox.UseVisualStyleBackColor = True
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(632, 72)
Me.Label6.ForeColor = System.Drawing.Color.Black
Me.Label6.Location = New System.Drawing.Point(6, 23)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(117, 27)
Me.Label6.Size = New System.Drawing.Size(96, 22)
Me.Label6.TabIndex = 24
Me.Label6.Text = "Использовать свои имена полей"
Me.Label6.Text = "Имя индекса"
'
'StartAt
'GroupBox2
'
Me.StartAt.Text = "Начальная дата"
Me.StartAt.Width = 150
Me.GroupBox2.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.GroupBox2.Controls.Add(Me.LabelIndexNameExample)
Me.GroupBox2.Controls.Add(Me.CheckBoxSplitIndexByPeriods)
Me.GroupBox2.Controls.Add(Me.ComboBoxESIndexPostfix)
Me.GroupBox2.Controls.Add(Me.Label6)
Me.GroupBox2.Controls.Add(Me.ESIndexNameTextBox)
Me.GroupBox2.Controls.Add(Me.UseSynonymsForFieldsNamesCheckBox)
Me.GroupBox2.Font = New System.Drawing.Font("Tahoma", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.GroupBox2.ForeColor = System.Drawing.Color.Maroon
Me.GroupBox2.Location = New System.Drawing.Point(6, 70)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(750, 78)
Me.GroupBox2.TabIndex = 25
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "Параметры для ElasticSearch"
'
'LabelIndexNameExample
'
Me.LabelIndexNameExample.AutoSize = True
Me.LabelIndexNameExample.Location = New System.Drawing.Point(283, 51)
Me.LabelIndexNameExample.Name = "LabelIndexNameExample"
Me.LabelIndexNameExample.Size = New System.Drawing.Size(166, 17)
Me.LabelIndexNameExample.TabIndex = 28
Me.LabelIndexNameExample.Text = "Пример имени индекса: "
'
'CheckBoxSplitIndexByPeriods
'
Me.CheckBoxSplitIndexByPeriods.AutoSize = True
Me.CheckBoxSplitIndexByPeriods.ForeColor = System.Drawing.Color.Black
Me.CheckBoxSplitIndexByPeriods.Location = New System.Drawing.Point(283, 23)
Me.CheckBoxSplitIndexByPeriods.Name = "CheckBoxSplitIndexByPeriods"
Me.CheckBoxSplitIndexByPeriods.Size = New System.Drawing.Size(329, 21)
Me.CheckBoxSplitIndexByPeriods.TabIndex = 27
Me.CheckBoxSplitIndexByPeriods.Text = "Разделять индекс по периодам с постфиксом:"
Me.CheckBoxSplitIndexByPeriods.UseVisualStyleBackColor = True
'
'ComboBoxESIndexPostfix
'
Me.ComboBoxESIndexPostfix.FormattingEnabled = True
Me.ComboBoxESIndexPostfix.Items.AddRange(New Object() {"yyyy", "yyyyMM", "yyyyMMdd", "yyyyMMddHH"})
Me.ComboBoxESIndexPostfix.Location = New System.Drawing.Point(618, 22)
Me.ComboBoxESIndexPostfix.Name = "ComboBoxESIndexPostfix"
Me.ComboBoxESIndexPostfix.Size = New System.Drawing.Size(105, 24)
Me.ComboBoxESIndexPostfix.TabIndex = 26
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(768, 547)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.UseSynonymsForFieldsNamesCheckBox)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.LinkLabel2)
Me.Controls.Add(Me.LinkLabel3)
Me.Controls.Add(Me.LinkLabel1)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.ESIndexNameTextBox)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.DBType)
Me.Controls.Add(Me.ConnectionStringBox)
@ -369,6 +395,8 @@ Partial Class Form1
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Form1"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox2.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
@ -391,15 +419,17 @@ Partial Class Form1
Friend WithEvents InfobaseLogPath As System.Windows.Forms.ColumnHeader
Friend WithEvents DBType As System.Windows.Forms.ComboBox
Friend WithEvents ButtonAddPath As System.Windows.Forms.Button
Friend WithEvents Label3 As Label
Friend WithEvents ESIndexNameTextBox As TextBox
Friend WithEvents ESServerName As ColumnHeader
Friend WithEvents Label4 As Label
Friend WithEvents LinkLabel2 As LinkLabel
Friend WithEvents LinkLabel1 As LinkLabel
Friend WithEvents LinkLabel3 As LinkLabel
Friend WithEvents Label5 As Label
Friend WithEvents UseSynonymsForFieldsNamesCheckBox As CheckBox
Friend WithEvents Label6 As Label
Friend WithEvents StartAt As ColumnHeader
Friend WithEvents GroupBox2 As GroupBox
Friend WithEvents LabelIndexNameExample As Label
Friend WithEvents CheckBoxSplitIndexByPeriods As CheckBox
Friend WithEvents ComboBoxESIndexPostfix As ComboBox
End Class

View File

@ -14,6 +14,15 @@ Public Class Form1
Dim ConfigSetting As ConfigSetting = New ConfigSetting
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Sub LoadConfigSetting()
ConfigSetting = ConfigSettingsModule.LoadConfigSettingFromFile(PathConfigFile)
@ -94,6 +103,15 @@ Public Class Form1
If String.IsNullOrEmpty(ConfigSetting.ESFieldSynonyms.UserName) Then
ConfigSetting.ESFieldSynonyms.UserName = "ИмяПользователя"
End If
If String.IsNullOrEmpty(ConfigSetting.ESFieldSynonyms.Transaction) Then
ConfigSetting.ESFieldSynonyms.Transaction = "ТранзакцияНомер"
End If
If String.IsNullOrEmpty(ConfigSetting.ESFieldSynonyms.TransactionStartTime) Then
ConfigSetting.ESFieldSynonyms.TransactionStartTime = "ТранзакцияВремя"
End If
If String.IsNullOrEmpty(ConfigSetting.ESFieldSynonyms.TransactionStatus) Then
ConfigSetting.ESFieldSynonyms.TransactionStatus = "ТранзакцияСтатус"
End If
ConnectionStringBox.Text = ConfigSetting.ConnectionString
DBType.Text = ConfigSetting.DBType
@ -101,6 +119,9 @@ Public Class Form1
ESIndexNameTextBox.Text = ConfigSetting.ESIndexName
UseSynonymsForFieldsNamesCheckBox.Checked = ConfigSetting.ESUseSynonymsForFieldsNames
CheckBoxSplitIndexByPeriods.Checked = Not String.IsNullOrEmpty(ConfigSetting.ESUseIndexPostfix)
ComboBoxESIndexPostfix.Text = ConfigSetting.ESUseIndexPostfix
End Sub
@ -142,6 +163,10 @@ Public Class Form1
NewConfigSetting.DBType = DBType.Text.Trim
NewConfigSetting.ESIndexName = ESIndexNameTextBox.Text
If CheckBoxSplitIndexByPeriods.Checked Then
NewConfigSetting.ESUseIndexPostfix = ComboBoxESIndexPostfix.Text
End If
For Each Item As ListViewItem In ListView.Items
If Item.Checked Then
@ -165,7 +190,6 @@ Public Class Form1
NewConfigSetting.RepeatTime = IIf(Rep = 0, 60, Rep)
ConfigSettingsModule.SaveConfigSettingToFile(NewConfigSetting, PathConfigFile)
Dim sc = New System.ServiceProcess.ServiceController("EventLog loader service")
Try
If sc.Status = ServiceProcess.ServiceControllerStatus.Running Then
@ -235,6 +259,8 @@ Public Class Form1
RefreshInfobaseList()
ShowIndexNameExample()
End Sub
@ -552,7 +578,7 @@ Public Class Form1
End Sub
Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs)
Process.Start("https://github.com/alekseybochkov/")
End Sub
@ -564,4 +590,29 @@ Public Class Form1
Process.Start("https://github.com/alekseybochkov/EventLogLoader/")
End Sub
Private Sub ESIndexNameTextBox_TextChanged(sender As Object, e As EventArgs) Handles ESIndexNameTextBox.TextChanged
ShowIndexNameExample()
End Sub
Sub ShowIndexNameExample()
Dim Postfix = ""
If CheckBoxSplitIndexByPeriods.Checked Then
Postfix = Now.ToString(ComboBoxESIndexPostfix.Text)
End If
LabelIndexNameExample.Text = "Пример имени индекса: " + ESIndexNameTextBox.Text + Postfix
End Sub
Private Sub ComboBoxESIndexPostfix_TextChanged(sender As Object, e As EventArgs) Handles ComboBoxESIndexPostfix.TextChanged
ShowIndexNameExample()
End Sub
Private Sub CheckBoxSplitIndexByPeriods_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxSplitIndexByPeriods.CheckedChanged
ShowIndexNameExample()
End Sub
End Class

View File

@ -32,6 +32,9 @@ Public Module ConfigSettingsModule
Public SecondaryPort As String
Public Application As String
Public UserName As String
Public Transaction As String
Public TransactionStatus As String
Public TransactionStartTime As String
End Class
Class ConfigSetting
@ -39,6 +42,7 @@ Public Module ConfigSettingsModule
Public DBType As String = ""
Public RepeatTime As Integer = 0
Public ESIndexName As String = ""
Public ESUseIndexPostfix As String = ""
Public ESUseSynonymsForFieldsNames As Boolean = False
Public ESFieldSynonyms As ElasticSearchFieldSynonymsClass
Public Infobases As List(Of InfobaseSetting)

View File

@ -206,11 +206,15 @@ Public Class EventLogProcessor
Public SecondaryPort As Integer
Public Server As String
Public SessionDataSplitCode As Integer
Public TransactionStatus As String
Public Transaction As Integer
Public TransactionStartTime As Date
End Class
Public EventsList As List(Of OneEventRecord) = New List(Of OneEventRecord)
Public ESIndexName As String
Public ESIndexPostfix As String
Public ESServerName As String
Public InfobaseName As String
@ -848,9 +852,25 @@ Public Class EventLogProcessor
Dim _current = New ElasticClient(_settings)
'Let's create proper array for ES
Dim NewRecords As List(Of Object) = New List(Of Object)
Dim NewRecordsByIndex As Dictionary(Of String, List(Of Object)) = New Dictionary(Of String, List(Of Object))
'Dim NewRecords As List(Of Object) = New List(Of Object)
For Each EventRecord In EventsList
Dim TargetIndexName = ESIndexName
If ESIndexPostfix.Length > 0 Then
Try
TargetIndexName = TargetIndexName + EventRecord.DateTime.ToString(ESIndexPostfix)
Catch ex As Exception
End Try
End If
If Not NewRecordsByIndex.ContainsKey(TargetIndexName) Then
NewRecordsByIndex.Add(TargetIndexName, New List(Of Object))
End If
Dim ESRecord = New ESRecord With {.ServerName = ESServerName, .DatabaseName = InfobaseName}
ESRecord.RowID = EventRecord.RowID
@ -874,6 +894,9 @@ Public Class EventLogProcessor
ESRecord.Comment = EventRecord.Comment
ESRecord.SessionDataSplitCode = EventRecord.SessionDataSplitCode
ESRecord.Transaction = EventRecord.TransactionMark
ESRecord.TransactionStartTime = EventRecord.TransactionStartTime
ESRecord.TransactionStatus = EventRecord.TransactionStatus
Dim EventObj = New EventType
If DictEvents.TryGetValue(EventRecord.EventID, EventObj) Then
@ -939,19 +962,50 @@ Public Class EventLogProcessor
ESRecordUserFields.Add(ESFieldSynonyms.Application, ESRecord.Application)
ESRecordUserFields.Add(ESFieldSynonyms.UserName, ESRecord.UserName)
NewRecords.Add(ESRecordUserFields)
ESRecordUserFields.Add(ESFieldSynonyms.Transaction, ESRecord.Transaction)
ESRecordUserFields.Add(ESFieldSynonyms.TransactionStartTime, ESRecord.TransactionStartTime)
ESRecordUserFields.Add(ESFieldSynonyms.TransactionStatus, ESRecord.TransactionStatus)
'NewRecords.Add(ESRecordUserFields)
NewRecordsByIndex(TargetIndexName).Add(ESRecordUserFields)
Else
NewRecords.Add(ESRecord)
'NewRecords.Add(ESRecord)
NewRecordsByIndex(TargetIndexName).Add(ESRecord)
End If
Next
Dim Result = _current.IndexMany(NewRecords, ESIndexName, "event-log-record")
For Each NewRecordsKV In NewRecordsByIndex
Dim AttemptCount = 0
While True
Dim Result = _current.IndexMany(NewRecordsKV.Value, NewRecordsKV.Key, "event-log-record")
If Not Result.IsValid Then
If AttemptCount >= 5 Then
Throw New Exception("Writing attempts failed because <" + ConnectionString + "> server did not properly respond!")
End If
Console.WriteLine(Now.ToLongTimeString + " Error writing to the server <" + ConnectionString + ">. " + Result.OriginalException.Message + ". Waiting for 10 seconds...")
Threading.Thread.Sleep(10000)
Else
Console.WriteLine(Now.ToLongTimeString + " -> " + NewRecordsKV.Value.Count.ToString + " new records have been written to '" + NewRecordsKV.Key + "' index")
Exit While
End If
AttemptCount = AttemptCount + 1
End While
Next
Console.WriteLine(Now.ToShortTimeString + " New records have been processed " + NewRecords.Count.ToString)
SaveReadParametersToFile()
@ -1270,11 +1324,11 @@ Public Class EventLogProcessor
OneEvent.TransactionStatus = rs("transactionStatus")
OneEvent.TransactionMark = rs("transactionID")
OneEvent.TransactionStartTime = New Date().AddYears(2000)
Try
If Not rs("transactionDate") = 0 Then
OneEvent.TransactionStartTime = New Date().AddSeconds(Convert.ToInt64(rs("transactionDate") / 10000))
Else
OneEvent.TransactionStartTime = New Date().AddYears(2000)
End If
Catch ex As Exception
End Try
@ -1309,7 +1363,7 @@ Public Class EventLogProcessor
OneEvent.SessionNumber = rs("session")
OneEvent.SessionDataSplitCode = rs("sessionDataSplitCode")
OneEvent.Transaction = ""
'OneEvent.Transaction = ""
OneEvent.EventType = ""
EventsList.Add(OneEvent)
@ -1600,7 +1654,7 @@ Public Class EventLogProcessor
While True
Console.WriteLine(Now.ToShortTimeString + " Start new iteration...")
Console.WriteLine(Now.ToLongTimeString + " Start new iteration...")
Try

View File

@ -62,6 +62,7 @@ Public Class EventLogLoaderService
EventLogProcessorObj.ItIsMySQL = ItIsMySQL
EventLogProcessorObj.ItIsES = ItIsES
EventLogProcessorObj.ESIndexName = ConfigSettingObj.ESIndexName
EventLogProcessorObj.ESIndexPostfix = ConfigSettingObj.ESUseIndexPostfix
EventLogProcessorObj.ESServerName = IBConfig.ESServerName
EventLogProcessorObj.ESUseSynonymsForFieldsNames = ConfigSettingObj.ESUseSynonymsForFieldsNames
EventLogProcessorObj.ESFieldSynonyms = ConfigSettingObj.ESFieldSynonyms
@ -82,7 +83,7 @@ Public Class EventLogLoaderService
Log.Error("File config.json was not found!")
End If
Catch ex As Exception
Log.Error(ex, "Parameters cannot be load from config.json file (it may be corrupted)")
Log.Error(ex, "Parameters cannot be loaded from config.json (it may be corrupted)")
End Try