You've already forked EventLogLoader
mirror of
https://github.com/romanlryji/EventLogLoader.git
synced 2025-12-07 23:23:44 +02:00
C# application
This commit is contained in:
6
EventLogApp/App.config
Normal file
6
EventLogApp/App.config
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
||||||
22
EventLogApp/ConfigSetting.cs
Normal file
22
EventLogApp/ConfigSetting.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
public class ConfigSetting
|
||||||
|
{
|
||||||
|
public string ConnectionString { get; set; }
|
||||||
|
public string DBType { get; set; }
|
||||||
|
public int RepeatTime { get; set; }
|
||||||
|
public string ESIndexName { get; set; }
|
||||||
|
public bool ESUseSynonymsForFieldsNames { get; set; }
|
||||||
|
public ElasticSearchFieldSynonymsClass ESFieldSynonyms { get; set; }
|
||||||
|
public List<InfobaseSetting> Infobases { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public ConfigSetting()
|
||||||
|
{
|
||||||
|
Infobases = new List<InfobaseSetting>();
|
||||||
|
ESFieldSynonyms = new ElasticSearchFieldSynonymsClass();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
EventLogApp/ConfigSettings.cs
Normal file
30
EventLogApp/ConfigSettings.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
class ConfigSettings
|
||||||
|
{
|
||||||
|
public static ConfigSetting LoadConfigSettingFromFile(string ConfigFilePath)
|
||||||
|
{
|
||||||
|
if (File.Exists(ConfigFilePath))
|
||||||
|
{
|
||||||
|
string JsonText = File.ReadAllText(ConfigFilePath);
|
||||||
|
|
||||||
|
ConfigSetting ConfigSettingObj = JsonConvert.DeserializeObject<ConfigSetting>(JsonText);
|
||||||
|
|
||||||
|
return ConfigSettingObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ConfigSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void SaveConfigSettingToFile(ConfigSetting ConfigSettingObj, string ConfigFilePath)
|
||||||
|
{
|
||||||
|
string JsonText = JsonConvert.SerializeObject(ConfigSettingObj, Formatting.Indented);
|
||||||
|
|
||||||
|
File.WriteAllText(ConfigFilePath, JsonText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
EventLogApp/ElasticSearchFieldSynonymsClass.cs
Normal file
26
EventLogApp/ElasticSearchFieldSynonymsClass.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
public class ElasticSearchFieldSynonymsClass
|
||||||
|
{
|
||||||
|
public string ServerName { get; set; }
|
||||||
|
public string DatabaseName { get; set; }
|
||||||
|
public string RowID { get; set; }
|
||||||
|
public string Severity { get; set; }
|
||||||
|
public string DateTime { get; set; }
|
||||||
|
public string ConnectID { get; set; }
|
||||||
|
public string DataType { get; set; }
|
||||||
|
public string SessionNumber { get; set; }
|
||||||
|
public string DataStructure { get; set; }
|
||||||
|
public string DataString { get; set; }
|
||||||
|
public string Comment { get; set; }
|
||||||
|
public string SessionDataSplitCode { get; set; }
|
||||||
|
public string EventType { get; set; }
|
||||||
|
public string Metadata { get; set; }
|
||||||
|
public string Computer { get; set; }
|
||||||
|
public string PrimaryPort { get; set; }
|
||||||
|
public string Server { get; set; }
|
||||||
|
public string SecondaryPort { get; set; }
|
||||||
|
public string Application { get; set; }
|
||||||
|
public string UserName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
9
EventLogApp/EventElements/Application.cs
Normal file
9
EventLogApp/EventElements/Application.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class Application : CodeNameType
|
||||||
|
{
|
||||||
|
public Application(long code, string name) : base(code, name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
EventLogApp/EventElements/CodeNameGuidType.cs
Normal file
12
EventLogApp/EventElements/CodeNameGuidType.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class CodeNameGuidType : CodeNameType
|
||||||
|
{
|
||||||
|
public string Guid;
|
||||||
|
|
||||||
|
public CodeNameGuidType(long code, string name, string guid) : base(code, name)
|
||||||
|
{
|
||||||
|
this.Guid = guid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
EventLogApp/EventElements/CodeNameType.cs
Normal file
22
EventLogApp/EventElements/CodeNameType.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class CodeNameType
|
||||||
|
{
|
||||||
|
public long Code;
|
||||||
|
public string Name;
|
||||||
|
|
||||||
|
public CodeNameType(long code, string name)
|
||||||
|
{
|
||||||
|
this.Code = code;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
this.Name = string.Empty;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
EventLogApp/EventElements/Computer.cs
Normal file
9
EventLogApp/EventElements/Computer.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class Computer : CodeNameType
|
||||||
|
{
|
||||||
|
public Computer(long code, string name) : base(code, name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
EventLogApp/EventElements/ESRecord.cs
Normal file
28
EventLogApp/EventElements/ESRecord.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class ESRecord
|
||||||
|
{
|
||||||
|
public long RowID { get; set; }
|
||||||
|
public string ServerName { get; set; }
|
||||||
|
public string DatabaseName { get; set; }
|
||||||
|
public DateTime DateTime { get; set; }
|
||||||
|
public string Severity { get; set; }
|
||||||
|
public EventType EventType { get; set; }
|
||||||
|
public string Computer { get; set; }
|
||||||
|
public string Application { get; set; }
|
||||||
|
public Metadata Metadata { get; set; }
|
||||||
|
public User UserName { get; set; }
|
||||||
|
public int SessionNumber { get; set; }
|
||||||
|
public int ConnectID { get; set; }
|
||||||
|
public int DataType { get; set; }
|
||||||
|
public string DataStructure { get; set; }
|
||||||
|
public string DataString { get; set; }
|
||||||
|
public string Comment { get; set; }
|
||||||
|
public string PrimaryPort { get; set; }
|
||||||
|
public string SecondaryPort { get; set; }
|
||||||
|
public string Server { get; set; }
|
||||||
|
public int SessionDataSplitCode { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
27
EventLogApp/EventElements/EventElementsDictionary.cs
Normal file
27
EventLogApp/EventElements/EventElementsDictionary.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
//using Nest;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class EventElementsDictionary<T> : Dictionary<long, T> where T : CodeNameType
|
||||||
|
{
|
||||||
|
//private Dictionary<int, T> dictionary = new Dictionary<int, T>();
|
||||||
|
|
||||||
|
public EventElementsDictionary() : base() { }
|
||||||
|
|
||||||
|
EventElementsDictionary(int capacity) : base(capacity) { }
|
||||||
|
|
||||||
|
public void Add(T item)
|
||||||
|
{
|
||||||
|
if (typeof(T).IsSubclassOf(typeof(CodeNameGuidType)))
|
||||||
|
{
|
||||||
|
if (base.ContainsKey(item.Code))
|
||||||
|
{
|
||||||
|
base.Remove(item.Code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Add(item.Code, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
EventLogApp/EventElements/EventType.cs
Normal file
9
EventLogApp/EventElements/EventType.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class EventType : CodeNameType
|
||||||
|
{
|
||||||
|
public EventType(long code, string name) : base(code, name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
EventLogApp/EventElements/MainPort.cs
Normal file
9
EventLogApp/EventElements/MainPort.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class MainPort : CodeNameType
|
||||||
|
{
|
||||||
|
public MainPort(long code, string name) : base(code, name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
EventLogApp/EventElements/Metadata.cs
Normal file
9
EventLogApp/EventElements/Metadata.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class Metadata : CodeNameGuidType
|
||||||
|
{
|
||||||
|
public Metadata(long code, string name, string guid) : base(code, name, guid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
198
EventLogApp/EventElements/OneEventRecord.cs
Normal file
198
EventLogApp/EventElements/OneEventRecord.cs
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
//using Nest;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SQLite;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
public class OneEventRecord
|
||||||
|
{
|
||||||
|
public NLog.Logger Log;
|
||||||
|
|
||||||
|
public long RowID { get; set; }
|
||||||
|
public DateTime DateTime { get; set; }
|
||||||
|
public long ConnectID { get; set; }
|
||||||
|
public long Severity { get; set; }
|
||||||
|
public string TransactionStatus { get; set; }
|
||||||
|
public string Transaction { get; set; }
|
||||||
|
public DateTime TransactionStartTime { get; set; }
|
||||||
|
public long TransactionMark { get; set; }
|
||||||
|
public long UserName { get; set; }
|
||||||
|
public long ComputerName { get; set; }
|
||||||
|
public long AppName { get; set; }
|
||||||
|
public long EventID { get; set; }
|
||||||
|
public string EventType { get; set; }
|
||||||
|
public string Comment { get; set; }
|
||||||
|
public int MetadataID;
|
||||||
|
public long SessionDataSplitCode { get; set; }
|
||||||
|
public string DataStructure { get; set; }
|
||||||
|
public string DataString { get; set; }
|
||||||
|
public long DataType { get; set; }
|
||||||
|
public long ServerID { get; set; }
|
||||||
|
public long MainPortID { get; set; }
|
||||||
|
public long SecondPortID { get; set; }
|
||||||
|
public long SessionNumber { get; set; }
|
||||||
|
|
||||||
|
private string eventString;
|
||||||
|
|
||||||
|
public OneEventRecord()
|
||||||
|
{
|
||||||
|
Log = NLog.LogManager.GetLogger("CurrentThread");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public OneEventRecord(string eventString)
|
||||||
|
{
|
||||||
|
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||||
|
|
||||||
|
this.eventString = eventString;
|
||||||
|
|
||||||
|
List<string> parsedEvent = ParserServices.ParseEventLogString(eventString);
|
||||||
|
DateTime = DateTime.ParseExact(parsedEvent[0], "yyyyMMddHHmmss", provider);
|
||||||
|
TransactionStatus = parsedEvent[1];
|
||||||
|
|
||||||
|
string transactionString = parsedEvent[2].ToString().Replace("}", "").Replace("{", "");
|
||||||
|
|
||||||
|
long transactionDate = From16To10(transactionString.Substring(0, transactionString.IndexOf(",")));
|
||||||
|
|
||||||
|
TransactionStartTime = new DateTime().AddYears(2000);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (transactionDate != 0)
|
||||||
|
{
|
||||||
|
TransactionStartTime = new DateTime().AddSeconds(Convert.ToInt64(transactionDate / 10000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, this.GetType().ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
TransactionMark = From16To10(transactionString.Substring(transactionString.IndexOf(",") + 1));
|
||||||
|
|
||||||
|
Transaction = parsedEvent[2];
|
||||||
|
UserName = Convert.ToInt32(parsedEvent[3]);
|
||||||
|
ComputerName = Convert.ToInt32(parsedEvent[4]);
|
||||||
|
AppName = Convert.ToInt32(parsedEvent[5]);
|
||||||
|
EventID = Convert.ToInt32(parsedEvent[7]);
|
||||||
|
EventType = parsedEvent[8];
|
||||||
|
Comment = parsedEvent[9].RemoveQuotes();
|
||||||
|
MetadataID = Convert.ToInt32(parsedEvent[10]);
|
||||||
|
DataStructure = parsedEvent[11];
|
||||||
|
DataString = parsedEvent[12].RemoveQuotes();
|
||||||
|
ServerID = Convert.ToInt32(parsedEvent[13]);
|
||||||
|
MainPortID = Convert.ToInt32(parsedEvent[14]);
|
||||||
|
SecondPortID = Convert.ToInt32(parsedEvent[15]);
|
||||||
|
SessionNumber = Convert.ToInt32(parsedEvent[16]);
|
||||||
|
|
||||||
|
if (DataStructure == "{\"U\"}") //'empty reference
|
||||||
|
{
|
||||||
|
DataStructure = string.Empty;
|
||||||
|
}
|
||||||
|
else if (DataStructure.StartsWith("{"))
|
||||||
|
{
|
||||||
|
//'internal representation for different objects.
|
||||||
|
List<string> ParsedObject = ParserServices.ParseEventLogString(DataStructure);
|
||||||
|
|
||||||
|
if (ParsedObject.Count == 2)
|
||||||
|
{
|
||||||
|
if (ParsedObject[0] == "\"S\"" || ParsedObject[0] == "\"R\"") //'this is string or reference
|
||||||
|
DataStructure = ParsedObject[1].RemoveQuotes(); //'string value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (EventType)
|
||||||
|
{
|
||||||
|
case "I":
|
||||||
|
Severity = 1;// '"Information";
|
||||||
|
break;
|
||||||
|
case "W":
|
||||||
|
Severity = 2;// '"Warning"
|
||||||
|
break;
|
||||||
|
case "E":
|
||||||
|
Severity = 3;// '"Error"
|
||||||
|
break;
|
||||||
|
case "N":
|
||||||
|
Severity = 4;// '"Note"
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public OneEventRecord(SQLiteDataReader reader)
|
||||||
|
{
|
||||||
|
System.Text.Encoding ANSI = System.Text.Encoding.GetEncoding(1252);
|
||||||
|
System.Text.Encoding UTF8 = System.Text.Encoding.UTF8;
|
||||||
|
|
||||||
|
RowID = (long)reader["rowID"];
|
||||||
|
Severity = (long)reader["severity"];
|
||||||
|
ConnectID = (long)reader["connectID"];
|
||||||
|
DateTime = new DateTime().AddSeconds(Convert.ToInt64((long)reader["date"] / 10000));
|
||||||
|
TransactionStatus = reader["transactionStatus"].ToString();
|
||||||
|
TransactionMark = (long)reader["transactionID"];
|
||||||
|
TransactionStartTime = new DateTime().AddYears(2000);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ((long)reader["transactionDate"] != 0)
|
||||||
|
{
|
||||||
|
TransactionStartTime = new DateTime().AddSeconds(Convert.ToInt64((long)reader["transactionDate"] / 10000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, this.GetType().ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
UserName = (long)reader["userCode"];
|
||||||
|
ComputerName = (long)reader["computerCode"];
|
||||||
|
AppName = (long)reader["appCode"];
|
||||||
|
EventID = (long)reader["eventCode"];
|
||||||
|
Comment = (string)reader["comment"];
|
||||||
|
|
||||||
|
string MDCodes = (string)reader["metadataCodes"];
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(MDCodes))
|
||||||
|
{
|
||||||
|
MetadataID = 0;
|
||||||
|
}
|
||||||
|
else if (MDCodes.Contains(","))
|
||||||
|
{
|
||||||
|
string MDCode = MDCodes.Split(',')[0];
|
||||||
|
int.TryParse(MDCode, out MetadataID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int.TryParse(MDCodes, out MetadataID);
|
||||||
|
}
|
||||||
|
|
||||||
|
string s = string.Empty;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty((string)reader["data"]))
|
||||||
|
{
|
||||||
|
s = UTF8.GetString(ANSI.GetBytes((string)reader["data"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
DataStructure = s;
|
||||||
|
|
||||||
|
DataType = (long)reader["dataType"];
|
||||||
|
DataString = (string)reader["dataPresentation"];
|
||||||
|
ServerID = (long)reader["workServerCode"];
|
||||||
|
MainPortID = (long)reader["primaryPortCode"];
|
||||||
|
SecondPortID = (long)reader["secondaryPortCode"];
|
||||||
|
SessionNumber = (long)reader["session"];
|
||||||
|
SessionDataSplitCode = (long)reader["sessionDataSplitCode"];
|
||||||
|
|
||||||
|
Transaction = string.Empty;
|
||||||
|
EventType = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private long From16To10(string str)
|
||||||
|
{
|
||||||
|
return long.Parse(str, NumberStyles.HexNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
9
EventLogApp/EventElements/SecondPort.cs
Normal file
9
EventLogApp/EventElements/SecondPort.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class SecondPort : CodeNameType
|
||||||
|
{
|
||||||
|
public SecondPort(long code, string name) : base(code, name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
EventLogApp/EventElements/Server.cs
Normal file
9
EventLogApp/EventElements/Server.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class Server : CodeNameType
|
||||||
|
{
|
||||||
|
public Server(long code, string name) : base(code, name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
EventLogApp/EventElements/StringExtension.cs
Normal file
22
EventLogApp/EventElements/StringExtension.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
public static class StringExtension
|
||||||
|
{
|
||||||
|
public static string RemoveQuotes(this string str)
|
||||||
|
{
|
||||||
|
string retval = str;
|
||||||
|
|
||||||
|
if (retval.StartsWith("\""))
|
||||||
|
{
|
||||||
|
retval = retval.Substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retval.EndsWith("\""))
|
||||||
|
{
|
||||||
|
retval = retval.Substring(0, retval.Length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
EventLogApp/EventElements/User.cs
Normal file
9
EventLogApp/EventElements/User.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class User : CodeNameGuidType
|
||||||
|
{
|
||||||
|
public User(long code, string name, string guid) : base(code, name, guid)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
161
EventLogApp/EventLogApp.csproj
Normal file
161
EventLogApp/EventLogApp.csproj
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{036F352B-E448-47E0-BB91-F98D4896C6CA}</ProjectGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>EventLogApp</RootNamespace>
|
||||||
|
<AssemblyName>EventLogApp</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<PublishUrl>publish\</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="BouncyCastle.Crypto, Version=1.8.3.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||||
|
<HintPath>..\packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Google.Protobuf, Version=3.6.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="MySql.Data, Version=8.0.16.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\MySql.Data.8.0.16\lib\net452\MySql.Data.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.4.6.2\lib\net45\NLog.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Configuration.Install" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data.SQLite, Version=1.0.110.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Data.SQLite.Core.1.0.110.0\lib\net451\System.Data.SQLite.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Drawing.Design" />
|
||||||
|
<Reference Include="System.IO.Compression" />
|
||||||
|
<Reference Include="System.Management" />
|
||||||
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.ServiceModel" />
|
||||||
|
<Reference Include="System.ServiceProcess" />
|
||||||
|
<Reference Include="System.Transactions" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="EventElements\EventElementsDictionary.cs" />
|
||||||
|
<Compile Include="EventElements\Application.cs" />
|
||||||
|
<Compile Include="EventElements\Computer.cs" />
|
||||||
|
<Compile Include="EventElements\CodeNameGuidType.cs" />
|
||||||
|
<Compile Include="EventElements\CodeNameType.cs" />
|
||||||
|
<Compile Include="ConfigSetting.cs" />
|
||||||
|
<Compile Include="ConfigSettings.cs" />
|
||||||
|
<Compile Include="ElasticSearchFieldSynonymsClass.cs" />
|
||||||
|
<Compile Include="EventElements\ESRecord.cs" />
|
||||||
|
<Compile Include="EventElements\StringExtension.cs" />
|
||||||
|
<Compile Include="EventLogProcessor.cs" />
|
||||||
|
<Compile Include="EventLogService.cs">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="EventLogService.Designer.cs">
|
||||||
|
<DependentUpon>EventLogService.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="EventLogServiceInstaller.cs">
|
||||||
|
<SubType>Component</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="EventLogServiceInstaller.Designer.cs">
|
||||||
|
<DependentUpon>EventLogServiceInstaller.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="EventElements\EventType.cs" />
|
||||||
|
<Compile Include="InfobaseSetting.cs" />
|
||||||
|
<Compile Include="EventLogLoaderService.cs" />
|
||||||
|
<Compile Include="EventElements\OneEventRecord.cs" />
|
||||||
|
<Compile Include="EventElements\Metadata.cs" />
|
||||||
|
<Compile Include="EventElements\MainPort.cs" />
|
||||||
|
<Compile Include="ParserServices.cs" />
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="EventElements\User.cs" />
|
||||||
|
<Compile Include="EventElements\Server.cs" />
|
||||||
|
<Compile Include="EventElements\SecondPort.cs" />
|
||||||
|
<Compile Include="ReadParameters.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
<Content Include="NLog.config">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<None Include="NLog.xsd">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BootstrapperPackage Include=".NETFramework,Version=v4.7.1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>Microsoft .NET Framework 4.7.1 %28x86 and x64%29</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Import Project="..\packages\System.Data.SQLite.Core.1.0.110.0\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.110.0\build\net451\System.Data.SQLite.Core.targets')" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.110.0\build\net451\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.110.0\build\net451\System.Data.SQLite.Core.targets'))" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
338
EventLogApp/EventLogLoaderService.cs
Normal file
338
EventLogApp/EventLogLoaderService.cs
Normal file
@@ -0,0 +1,338 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
public class EventLogLoaderService
|
||||||
|
{
|
||||||
|
List<EventLogProcessor> ListOfProcessors = new List<EventLogProcessor>();
|
||||||
|
List<Thread> ArrayThread;
|
||||||
|
|
||||||
|
public ConfigSetting ConfigSettingObj = new ConfigSetting();
|
||||||
|
string ConnectionString;
|
||||||
|
string DBType;
|
||||||
|
bool ItIsMySQL;
|
||||||
|
bool ItIsMSSQL;
|
||||||
|
bool ItIsElasticSearch;
|
||||||
|
public int SleepTime = 60 * 1000; //1 мин
|
||||||
|
|
||||||
|
public Thread WorkerThread;
|
||||||
|
private NLog.Logger Log;
|
||||||
|
|
||||||
|
public EventLogLoaderService()
|
||||||
|
{
|
||||||
|
//InitializeComponent();
|
||||||
|
|
||||||
|
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
|
||||||
|
|
||||||
|
Log = NLog.LogManager.GetLogger("CurrentThread");
|
||||||
|
|
||||||
|
ArrayThread = new List<Thread>();
|
||||||
|
|
||||||
|
WorkerThread = new Thread(DoWork);
|
||||||
|
WorkerThread.SetApartmentState(ApartmentState.STA);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void DoWork()
|
||||||
|
{
|
||||||
|
if (!LoadConfigSetting())
|
||||||
|
{
|
||||||
|
Log.Error("Error while working with config.json file in application folder");
|
||||||
|
Environment.Exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateTables();
|
||||||
|
|
||||||
|
foreach (EventLogProcessor IB in ListOfProcessors)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IB.GetInfobaseIDFromDatabase();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error occurred while getting infobase ID from target database ({IB.InfobaseName})");
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var Thead = new Thread(IB.DoWork)
|
||||||
|
{
|
||||||
|
IsBackground = false
|
||||||
|
};
|
||||||
|
|
||||||
|
Thead.Start();
|
||||||
|
|
||||||
|
ArrayThread.Add(Thead);
|
||||||
|
|
||||||
|
//-------------------------------------
|
||||||
|
|
||||||
|
//IB.DoWork();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error occurred while starting new thread ({IB.InfobaseName})");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void CreateTables()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (ItIsMSSQL)
|
||||||
|
{
|
||||||
|
SqlConnection objConn = new SqlConnection(ConnectionString);
|
||||||
|
objConn.Open();
|
||||||
|
|
||||||
|
var command = new SqlCommand(@"IF NOT EXISTS (select * from sysobjects where id = object_id(N'Events'))
|
||||||
|
BEGIN
|
||||||
|
CREATE TABLE[dbo].[Events]([InfobaseCode] int Not NULL, [DateTime][datetime] Not NULL,
|
||||||
|
[TransactionStatus][varchar](1) NULL,
|
||||||
|
[TransactionStartTime][datetime] NULL,
|
||||||
|
|
||||||
|
[TransactionMark] bigint NULL,
|
||||||
|
[Transaction][varchar](100) NULL,
|
||||||
|
|
||||||
|
[UserName] int NULL,
|
||||||
|
|
||||||
|
[ComputerName] int NULL,
|
||||||
|
|
||||||
|
[AppName] Int NULL,
|
||||||
|
[EventID] int NULL,
|
||||||
|
|
||||||
|
[EventType][varchar](1) NULL,
|
||||||
|
[Comment][nvarchar](max) NULL,
|
||||||
|
|
||||||
|
[MetadataID] int NULL,
|
||||||
|
|
||||||
|
[DataStructure][nvarchar](max) NULL,
|
||||||
|
|
||||||
|
[DataString][nvarchar](max) NULL,
|
||||||
|
[ServerID] int NULL,
|
||||||
|
|
||||||
|
[MainPortID] int NULL,
|
||||||
|
[SecondPortID] int NULL,
|
||||||
|
|
||||||
|
[Seance] int NULL);
|
||||||
|
CREATE CLUSTERED INDEX[CIX_Events] ON[dbo].[Events]([InfobaseCode], [DateTime])
|
||||||
|
END", objConn);
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
command.CommandText = "IF NOT EXISTS (select * from sysobjects where id = object_id(N'Infobases'))" + Environment.NewLine +
|
||||||
|
" CREATE TABLE [dbo].[Infobases] ([Guid] [char](40) NOT NULL, [Code] int NOT NULL, [Name] [char](100))" + Environment.NewLine +
|
||||||
|
" IF NOT EXISTS (select * from sys.indexes where object_id = object_id(N'Infobases') AND Name = 'ClusteredIndex')" + Environment.NewLine +
|
||||||
|
" CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex] ON [dbo].[Infobases] ([Guid] ASC);";
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
command.CommandText =
|
||||||
|
"IF NOT EXISTS (select * from sysobjects where id = object_id(N'Users'))" + Environment.NewLine +
|
||||||
|
"CREATE TABLE [dbo].[Users]([InfobaseCode] int NOT NULL, [Code] int NOT NULL, [Name] [nvarchar](100), [Guid] [varchar](40));" + Environment.NewLine +
|
||||||
|
"IF NOT EXISTS (select * from sys.indexes where object_id = object_id(N'Users') AND Name = 'ClusteredIndex')" + Environment.NewLine +
|
||||||
|
"CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex] ON [dbo].[Users] ([InfobaseCode] ASC, [Code] ASC);" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"IF NOT EXISTS (select * from sysobjects where id = object_id(N'Metadata'))" + Environment.NewLine +
|
||||||
|
"CREATE TABLE [dbo].[Metadata]([InfobaseCode] int NOT NULL, [Code] int NOT NULL, [Name] [nvarchar](100), [Guid] [varchar](40));" + Environment.NewLine +
|
||||||
|
"IF NOT EXISTS (select * from sys.indexes where object_id = object_id(N'Metadata') AND Name = 'ClusteredIndex')" + Environment.NewLine +
|
||||||
|
"CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex] ON [dbo].[Metadata] ([InfobaseCode] ASC, [Code] ASC);" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"IF NOT EXISTS (select * from sysobjects where id = object_id(N'Computers'))" + Environment.NewLine +
|
||||||
|
"CREATE TABLE [dbo].[Computers]([InfobaseCode] int NOT NULL, [Code] int NOT NULL, [Name] [nvarchar](100));" + Environment.NewLine +
|
||||||
|
"IF NOT EXISTS (select * from sys.indexes where object_id = object_id(N'Computers') AND Name = 'ClusteredIndex')" + Environment.NewLine +
|
||||||
|
"CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex] ON [dbo].[Computers] ([InfobaseCode] ASC, [Code] ASC);" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"IF NOT EXISTS (select * from sysobjects where id = object_id(N'Applications'))" + Environment.NewLine +
|
||||||
|
"CREATE TABLE [dbo].[Applications]([InfobaseCode] int NOT NULL, [Code] int NOT NULL,[Name] [nvarchar](100));" + Environment.NewLine +
|
||||||
|
"IF NOT EXISTS (select * from sys.indexes where object_id = object_id(N'Applications') AND Name = 'ClusteredIndex')" + Environment.NewLine +
|
||||||
|
"CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex] ON [dbo].[Applications] ([InfobaseCode] ASC, [Code] ASC);" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"IF NOT EXISTS (select * from sysobjects where id = object_id(N'EventsType'))" + Environment.NewLine +
|
||||||
|
"CREATE TABLE [dbo].[EventsType]([InfobaseCode] int NOT NULL, [Code] int NOT NULL, [Name] [nvarchar](max));" + Environment.NewLine +
|
||||||
|
"IF NOT EXISTS (select * from sys.indexes where object_id = object_id(N'EventsType') AND Name = 'ClusteredIndex')" + Environment.NewLine +
|
||||||
|
"CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex] ON [dbo].[EventsType] ([InfobaseCode] ASC, [Code] ASC);" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"IF NOT EXISTS (select * from sysobjects where id = object_id(N'Servers'))" + Environment.NewLine +
|
||||||
|
"CREATE TABLE [dbo].[Servers]([InfobaseCode] int NOT NULL, [Code] int NOT NULL, [Name] [nvarchar](100));" + Environment.NewLine +
|
||||||
|
"IF NOT EXISTS (select * from sys.indexes where object_id = object_id(N'Servers') AND Name = 'ClusteredIndex')" + Environment.NewLine +
|
||||||
|
"CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex] ON [dbo].[Servers] ([InfobaseCode] ASC, [Code] ASC);" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"IF NOT EXISTS (select * from sysobjects where id = object_id(N'MainPorts'))" + Environment.NewLine +
|
||||||
|
"CREATE TABLE [dbo].[MainPorts]([InfobaseCode] int NOT NULL, [Code] int NOT NULL, [Name] [nvarchar](100));" + Environment.NewLine +
|
||||||
|
"IF NOT EXISTS (select * from sys.indexes where object_id = object_id(N'MainPorts') AND Name = 'ClusteredIndex')" + Environment.NewLine +
|
||||||
|
"CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex] ON [dbo].[MainPorts] ([InfobaseCode] ASC, [Code] ASC);" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"IF NOT EXISTS (select * from sysobjects where id = object_id(N'SecondPorts'))" + Environment.NewLine +
|
||||||
|
"CREATE TABLE [dbo].[SecondPorts]([InfobaseCode] int NOT NULL, [Code] int NOT NULL, [Name] [nvarchar](100));" + Environment.NewLine +
|
||||||
|
"IF NOT EXISTS (select * from sys.indexes where object_id = object_id(N'SecondPorts') AND Name = 'ClusteredIndex')" + Environment.NewLine +
|
||||||
|
"CREATE UNIQUE CLUSTERED INDEX [ClusteredIndex] ON [dbo].[SecondPorts] ([InfobaseCode] ASC, [Code] ASC);";
|
||||||
|
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
command.CommandText = "SELECT TOP 1 * FROM Events";
|
||||||
|
command.ExecuteReader();
|
||||||
|
|
||||||
|
command.Dispose();
|
||||||
|
objConn.Close();
|
||||||
|
objConn.Dispose();
|
||||||
|
}
|
||||||
|
else if (ItIsMySQL)
|
||||||
|
{
|
||||||
|
MySql.Data.MySqlClient.MySqlConnection objConn = new MySql.Data.MySqlClient.MySqlConnection(ConnectionString);
|
||||||
|
objConn.Open();
|
||||||
|
|
||||||
|
string DBName = objConn.Database;
|
||||||
|
|
||||||
|
MySql.Data.MySqlClient.MySqlCommand command = new MySql.Data.MySqlClient.MySqlCommand
|
||||||
|
{
|
||||||
|
Connection = objConn,
|
||||||
|
CommandText = "CREATE TABLE IF NOT EXISTS `Events` (`InfobaseCode` int(11) NOT NULL, `DateTime` int(11) NOT NULL," +
|
||||||
|
"`TransactionStatus` varchar(1) NULL, `TransactionStartTime` datetime NULL, " +
|
||||||
|
"`TransactionMark` bigint NULL, `Transaction` varchar(100) NULL, `UserName` int(11) NULL, `ComputerName` int(11) NULL, " +
|
||||||
|
"`AppName` int(11) NULL, `EventID` int(11) NULL, `EventType` varchar(1) NULL, " +
|
||||||
|
"`Comment` text NULL, `MetadataID` int(11) NULL, `DataStructure` text NULL, `DataString` text NULL, " +
|
||||||
|
"`ServerID` int(11) NULL, `MainPortID` int(11) NULL, `SecondPortID` int(11) NULL, `Seance` int(11) NULL" +
|
||||||
|
") ENGINE=InnoDB DEFAULT CHARSET=utf8;"
|
||||||
|
};
|
||||||
|
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
command.CommandText = "CREATE TABLE IF NOT EXISTS `Infobases` (`Guid` varchar(40) NOT NULL, `Code` int(11) NOT NULL, `Name` varchar(100)," +
|
||||||
|
"PRIMARY KEY `Guid` (`Guid`));";
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
command.CommandText =
|
||||||
|
"CREATE TABLE IF NOT EXISTS `Users`(`InfobaseCode` int(11) NOT NULL, `Code` int(11) NOT NULL, `Name` varchar(100), `Guid` varchar(40), PRIMARY KEY (`InfobaseCode`, `Code`));" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"CREATE TABLE IF NOT EXISTS `Metadata`(`InfobaseCode` int(11) NOT NULL, `Code` int(11) NOT NULL, `Name` varchar(100), `Guid` varchar(40), PRIMARY KEY (`InfobaseCode`, `Code`));" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"CREATE TABLE IF NOT EXISTS `Computers`(`InfobaseCode` int(11) NOT NULL, `Code` int(11) NOT NULL, `Name` varchar(100), PRIMARY KEY (`InfobaseCode`, `Code`));" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"CREATE TABLE IF NOT EXISTS `Applications`(`InfobaseCode` int(11) NOT NULL, `Code` int(11) NOT NULL, `Name` varchar(100), PRIMARY KEY (`InfobaseCode`, `Code`));" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"CREATE TABLE IF NOT EXISTS `EventsType`(`InfobaseCode` int(11) NOT NULL, `Code` int(11) NOT NULL, `Name` text, PRIMARY KEY (`InfobaseCode`, `Code`));" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"CREATE TABLE IF NOT EXISTS `Servers`(`InfobaseCode` int(11) NOT NULL, `Code` int(11) NOT NULL, `Name` varchar(100), PRIMARY KEY (`InfobaseCode`, `Code`));" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"CREATE TABLE IF NOT EXISTS `MainPorts`(`InfobaseCode` int(11) NOT NULL, `Code` int(11) NOT NULL, `Name` varchar(100), PRIMARY KEY (`InfobaseCode`, `Code`));" + Environment.NewLine +
|
||||||
|
"" +
|
||||||
|
"CREATE TABLE IF NOT EXISTS `SecondPorts`(`InfobaseCode` int(11) NOT NULL, `Code` int(11) NOT NULL, `Name` varchar(100), PRIMARY KEY (`InfobaseCode`, `Code`));";
|
||||||
|
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
command.Dispose();
|
||||||
|
objConn.Close();
|
||||||
|
objConn.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.Info("Target database tables have been verified!");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Error occurred while during target database tables verification");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool LoadConfigSetting()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string PathConfigFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json");
|
||||||
|
|
||||||
|
if (File.Exists(PathConfigFile))
|
||||||
|
{
|
||||||
|
ConfigSettingObj = ConfigSettings.LoadConfigSettingFromFile(PathConfigFile);
|
||||||
|
|
||||||
|
ConnectionString = ConfigSettingObj.ConnectionString;
|
||||||
|
DBType = ConfigSettingObj.DBType;
|
||||||
|
|
||||||
|
if (DBType == "MySQL")
|
||||||
|
{
|
||||||
|
ItIsMySQL = true;
|
||||||
|
}
|
||||||
|
else if (DBType == "MS SQL Server")
|
||||||
|
{
|
||||||
|
ItIsMSSQL = true;
|
||||||
|
}
|
||||||
|
else if (DBType == "ElasticSearch")
|
||||||
|
{
|
||||||
|
ItIsElasticSearch = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.SleepTime = this.ConfigSettingObj.RepeatTime * 1000;
|
||||||
|
|
||||||
|
foreach (InfobaseSetting IBConfig in ConfigSettingObj.Infobases)
|
||||||
|
{
|
||||||
|
string IB_ID = IBConfig.DatabaseID;
|
||||||
|
string IB_Name = IBConfig.DatabaseName;
|
||||||
|
string IB_Catalog = IBConfig.DatabaseCatalog;
|
||||||
|
|
||||||
|
EventLogProcessor EventLogProcessorObj = new EventLogProcessor
|
||||||
|
{
|
||||||
|
Log = NLog.LogManager.GetLogger("CurrentThread"),
|
||||||
|
InfobaseGuid = IB_ID,
|
||||||
|
InfobaseName = IB_Name,
|
||||||
|
Catalog = IB_Catalog,
|
||||||
|
ConnectionString = this.ConnectionString,
|
||||||
|
SleepTime = this.SleepTime,
|
||||||
|
ItIsMSSQL = this.ItIsMSSQL,
|
||||||
|
ItIsMySQL = this.ItIsMySQL,
|
||||||
|
ItIsElasticSearch = this.ItIsElasticSearch,
|
||||||
|
ESIndexName = this.ConfigSettingObj.ESIndexName,
|
||||||
|
ESServerName = IBConfig.ESServerName,
|
||||||
|
ESUseSynonymsForFieldsNames = this.ConfigSettingObj.ESUseSynonymsForFieldsNames,
|
||||||
|
ESFieldSynonyms = this.ConfigSettingObj.ESFieldSynonyms
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
EventLogProcessorObj.LoadEventsStartingAt = DateTime.Parse(IBConfig.StartDate);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
EventLogProcessorObj.LoadEventsStartingAt = new DateTime(1900, 1, 1);
|
||||||
|
|
||||||
|
Log.Error(ex, this.GetType().ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ListOfProcessors.Add(EventLogProcessorObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.Error("File config.json was not found!");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Parameters cannot be load from config.json file (it may be corrupted)");
|
||||||
|
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void SubStart()
|
||||||
|
{
|
||||||
|
WorkerThread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void SubStop()
|
||||||
|
{
|
||||||
|
WorkerThread.Abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
1369
EventLogApp/EventLogProcessor.cs
Normal file
1369
EventLogApp/EventLogProcessor.cs
Normal file
File diff suppressed because it is too large
Load Diff
37
EventLogApp/EventLogService.Designer.cs
generated
Normal file
37
EventLogApp/EventLogService.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
partial class EventLogService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Component Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
this.ServiceName = "EventLogService";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
32
EventLogApp/EventLogService.cs
Normal file
32
EventLogApp/EventLogService.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.ServiceProcess;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
partial class EventLogService : ServiceBase
|
||||||
|
{
|
||||||
|
public EventLogService()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStart(string[] args)
|
||||||
|
{
|
||||||
|
EventLogLoaderService service = new EventLogLoaderService();
|
||||||
|
|
||||||
|
service.DoWork();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStop()
|
||||||
|
{
|
||||||
|
// TODO: Add code here to perform any tear-down necessary to stop your service.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
EventLogApp/EventLogServiceInstaller.Designer.cs
generated
Normal file
36
EventLogApp/EventLogServiceInstaller.Designer.cs
generated
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
partial class EventLogServiceInstaller
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Component Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
33
EventLogApp/EventLogServiceInstaller.cs
Normal file
33
EventLogApp/EventLogServiceInstaller.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Configuration.Install;
|
||||||
|
using System.Linq;
|
||||||
|
using System.ServiceProcess;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
[RunInstaller(true)]
|
||||||
|
public partial class EventLogServiceInstaller : System.Configuration.Install.Installer
|
||||||
|
{
|
||||||
|
ServiceInstaller serviceInstaller;
|
||||||
|
ServiceProcessInstaller processInstaller;
|
||||||
|
|
||||||
|
|
||||||
|
public EventLogServiceInstaller()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
serviceInstaller = new ServiceInstaller();
|
||||||
|
processInstaller = new ServiceProcessInstaller();
|
||||||
|
|
||||||
|
processInstaller.Account = ServiceAccount.LocalSystem;
|
||||||
|
serviceInstaller.StartType = ServiceStartMode.Manual;
|
||||||
|
serviceInstaller.ServiceName = "EventLogService";
|
||||||
|
Installers.Add(processInstaller);
|
||||||
|
Installers.Add(serviceInstaller);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
EventLogApp/InfobaseSetting.cs
Normal file
12
EventLogApp/InfobaseSetting.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
public class InfobaseSetting
|
||||||
|
{
|
||||||
|
public string ESServerName { get; set; }
|
||||||
|
public string DatabaseID { get; set; }
|
||||||
|
public string DatabaseName { get; set; }
|
||||||
|
public string DatabaseCatalog { get; set; }
|
||||||
|
public string StartDate { get; set; }
|
||||||
|
public bool Found { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
41
EventLogApp/NLog.config
Normal file
41
EventLogApp/NLog.config
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||||
|
autoReload="true"
|
||||||
|
throwExceptions="false"
|
||||||
|
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||||
|
|
||||||
|
<!-- optional, add some variables
|
||||||
|
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||||
|
-->
|
||||||
|
<variable name="myvar" value="myvalue"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||||
|
for information on customizing logging rules and outputs.
|
||||||
|
-->
|
||||||
|
<targets>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
add your targets here
|
||||||
|
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||||
|
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Write events to a file with the date in the filename.
|
||||||
|
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||||
|
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||||
|
-->
|
||||||
|
</targets>
|
||||||
|
|
||||||
|
<rules>
|
||||||
|
<!-- add your logging rules here -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||||
|
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||||
|
-->
|
||||||
|
</rules>
|
||||||
|
</nlog>
|
||||||
3481
EventLogApp/NLog.xsd
Normal file
3481
EventLogApp/NLog.xsd
Normal file
File diff suppressed because it is too large
Load Diff
51
EventLogApp/ParserServices.cs
Normal file
51
EventLogApp/ParserServices.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
class ParserServices
|
||||||
|
{
|
||||||
|
public static List<string> ParseEventLogString(string Text)
|
||||||
|
{
|
||||||
|
List<string> ArrayLines = new List<string>();
|
||||||
|
|
||||||
|
var Text2 = Text.Substring(1, Text.EndsWith(",") ? Text.Length - 3 : Text.Length - 2) + ",";
|
||||||
|
|
||||||
|
var Delim = Text2.IndexOf(",");
|
||||||
|
|
||||||
|
string str = "";
|
||||||
|
|
||||||
|
while (Delim > 0)
|
||||||
|
{
|
||||||
|
str = str + Text2.Substring(0, Delim).Trim();
|
||||||
|
Text2 = Text2.Substring(Delim + 1);
|
||||||
|
|
||||||
|
if (CountSubstringInString(str, "{") == CountSubstringInString(str, "}") && Math.IEEERemainder(CountSubstringInString(str, "\""), 2) == 0)
|
||||||
|
{
|
||||||
|
if (str.StartsWith("\"") && str.EndsWith("\""))
|
||||||
|
{
|
||||||
|
str = str.Substring(1, str.Length - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayLines.Add(str);
|
||||||
|
|
||||||
|
str = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str = str + ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
Delim = Text2.IndexOf(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ArrayLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static int CountSubstringInString(string Str, string SubStr)
|
||||||
|
{
|
||||||
|
return (Str.Length - Str.Replace(SubStr, "").Length) / SubStr.Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
EventLogApp/Program.cs
Normal file
26
EventLogApp/Program.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System.ServiceProcess;
|
||||||
|
|
||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
EventLogLoaderService service = new EventLogLoaderService();
|
||||||
|
|
||||||
|
service.DoWork();
|
||||||
|
|
||||||
|
//------------------------------------------------------
|
||||||
|
|
||||||
|
//ServiceBase[] ServicesToRun;
|
||||||
|
|
||||||
|
//ServicesToRun = new ServiceBase[]
|
||||||
|
//{
|
||||||
|
// new EventLogService()
|
||||||
|
//};
|
||||||
|
|
||||||
|
//ServiceBase.Run(ServicesToRun);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
36
EventLogApp/Properties/AssemblyInfo.cs
Normal file
36
EventLogApp/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("EventLogApp")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("EventLogApp")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("036f352b-e448-47e0-bb91-f98d4896c6ca")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
10
EventLogApp/ReadParameters.cs
Normal file
10
EventLogApp/ReadParameters.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace EventLogApp
|
||||||
|
{
|
||||||
|
internal class ReadParameters
|
||||||
|
{
|
||||||
|
public int InfobaseId { get; set; }
|
||||||
|
public long CurrentPosition { get; set; }
|
||||||
|
public string CurrentFilename { get; set; }
|
||||||
|
public long LastEventNumber83 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
39
EventLogApp/config.json
Normal file
39
EventLogApp/config.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"ConnectionString": "Data Source=MSSQLSERVER;Server=srv-1cdata;Database=log1c;Password=1ccthdth;User ID=sa;",
|
||||||
|
"DBType": "MS SQL Server",
|
||||||
|
"RepeatTime": 60,
|
||||||
|
"ESIndexName": "event-log",
|
||||||
|
"ESUseSynonymsForFieldsNames": false,
|
||||||
|
"ESFieldSynonyms": {
|
||||||
|
"ServerName": "Сервер1С",
|
||||||
|
"DatabaseName": "ИнформационнаяБаза",
|
||||||
|
"RowID": "НомерСтроки",
|
||||||
|
"Severity": "УровеньСобытия",
|
||||||
|
"DateTime": "ДатаВремя",
|
||||||
|
"ConnectID": "НомерСоединения",
|
||||||
|
"DataType": "ТипДанных",
|
||||||
|
"SessionNumber": "НомерСессии",
|
||||||
|
"DataStructure": "СтруктураДанных",
|
||||||
|
"DataString": "ПредставлениеДанных",
|
||||||
|
"Comment": "Комментарий",
|
||||||
|
"SessionDataSplitCode": "Разделитель",
|
||||||
|
"EventType": "ТипСобытия",
|
||||||
|
"Metadata": "Метаданные",
|
||||||
|
"Computer": "Компьютер",
|
||||||
|
"PrimaryPort": "ОсновнойПорт",
|
||||||
|
"Server": "СерверПриложений",
|
||||||
|
"SecondaryPort": "ВторичныйПорт",
|
||||||
|
"Application": "Приложение",
|
||||||
|
"UserName": "ИмяПользователя"
|
||||||
|
},
|
||||||
|
"Infobases": [
|
||||||
|
{
|
||||||
|
"ESServerName": "",
|
||||||
|
"DatabaseID": "221faa36-9bda-4aa5-a5d6-a425e10d2955",
|
||||||
|
"DatabaseName": "un_acc30",
|
||||||
|
"DatabaseCatalog": "e:\\dev\\\1cLog\\1Cv8Log\\",
|
||||||
|
"StartDate": "",
|
||||||
|
"Found": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
11
EventLogApp/packages.config
Normal file
11
EventLogApp/packages.config
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="BouncyCastle" version="1.8.3.1" targetFramework="net472" />
|
||||||
|
<package id="Google.Protobuf" version="3.6.1" targetFramework="net472" />
|
||||||
|
<package id="MySql.Data" version="8.0.16" targetFramework="net452" />
|
||||||
|
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
|
||||||
|
<package id="NLog" version="4.6.2" targetFramework="net472" />
|
||||||
|
<package id="NLog.Config" version="4.6.2" targetFramework="net472" />
|
||||||
|
<package id="NLog.Schema" version="4.6.2" targetFramework="net472" />
|
||||||
|
<package id="System.Data.SQLite.Core" version="1.0.110.0" targetFramework="net452" />
|
||||||
|
</packages>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 14
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 14.0.25420.1
|
VisualStudioVersion = 15.0.28307.852
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EventLogLoaderDebug", "EventLogLoader\EventLogLoaderDebug.vbproj", "{2CE569B2-834D-4FE6-A23F-ACC68E8BDA9E}"
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EventLogLoaderDebug", "EventLogLoader\EventLogLoaderDebug.vbproj", "{2CE569B2-834D-4FE6-A23F-ACC68E8BDA9E}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -9,6 +9,8 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EventLogLoaderManager", "Ev
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EventLogLoaderService", "EventLogLoaderService\EventLogLoaderService.vbproj", "{F7EF5930-B310-4697-B522-2325EAF247F2}"
|
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EventLogLoaderService", "EventLogLoaderService\EventLogLoaderService.vbproj", "{F7EF5930-B310-4697-B522-2325EAF247F2}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventLogApp", "EventLogApp\EventLogApp.csproj", "{036F352B-E448-47E0-BB91-F98D4896C6CA}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -49,8 +51,23 @@ Global
|
|||||||
{F7EF5930-B310-4697-B522-2325EAF247F2}.Release|Mixed Platforms.Build.0 = Release|x86
|
{F7EF5930-B310-4697-B522-2325EAF247F2}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
{F7EF5930-B310-4697-B522-2325EAF247F2}.Release|x86.ActiveCfg = Release|x86
|
{F7EF5930-B310-4697-B522-2325EAF247F2}.Release|x86.ActiveCfg = Release|x86
|
||||||
{F7EF5930-B310-4697-B522-2325EAF247F2}.Release|x86.Build.0 = Release|x86
|
{F7EF5930-B310-4697-B522-2325EAF247F2}.Release|x86.Build.0 = Release|x86
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{036F352B-E448-47E0-BB91-F98D4896C6CA}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {5078F9AA-9CF7-46CF-BF5C-57C79E90A04A}
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
Reference in New Issue
Block a user