diff --git a/(Setup) Log 4 Graylog/(Setup) Log 4 Graylog.vdproj b/(Setup) Log 4 Graylog/(Setup) Log 4 Graylog.vdproj new file mode 100644 index 0000000..b5087f2 --- /dev/null +++ b/(Setup) Log 4 Graylog/(Setup) Log 4 Graylog.vdproj @@ -0,0 +1,737 @@ +"DeployProject" +{ +"VSVersion" = "3:800" +"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" +"IsWebType" = "8:FALSE" +"ProjectName" = "8:(Setup) Log 4 Graylog" +"LanguageId" = "3:1040" +"CodePage" = "3:1252" +"UILanguageId" = "3:1040" +"SccProjectName" = "8:" +"SccLocalPath" = "8:" +"SccAuxPath" = "8:" +"SccProvider" = "8:" + "Hierarchy" + { + "Entry" + { + "MsmKey" = "8:_485C7AAA71924496B4CCA8F2B60EB371" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + } + "Configurations" + { + "Debug" + { + "DisplayName" = "8:Debug" + "IsDebugOnly" = "11:TRUE" + "IsReleaseOnly" = "11:FALSE" + "OutputFilename" = "8:Debug\\(Setup) Log 4 Graylog.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + } + "Release" + { + "DisplayName" = "8:Release" + "IsDebugOnly" = "11:FALSE" + "IsReleaseOnly" = "11:TRUE" + "OutputFilename" = "8:Release\\(Setup) Log 4 Graylog.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.NetCore.CoreRuntime.9.0.x64" + { + "Name" = "8:Runtime di .NET 9.0.1 (x64)" + "ProductCode" = "8:Microsoft.NetCore.CoreRuntime.9.0.x64" + } + } + } + } + } + "Deployable" + { + "CustomAction" + { + } + "DefaultFeature" + { + "Name" = "8:DefaultFeature" + "Title" = "8:" + "Description" = "8:" + } + "ExternalPersistence" + { + "LaunchCondition" + { + "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_3218276E653746D7BBE9EAF6CFC78541" + { + "Name" = "8:.NET Core" + "Message" = "8:[VSDNETCOREMSG]" + "AllowLaterVersions" = "11:FALSE" + "InstallUrl" = "8:https://dotnet.microsoft.com/download/dotnet-core/[NetCoreVerMajorDotMinor]" + "IsNETCore" = "11:TRUE" + "Architecture" = "2:0" + "Runtime" = "2:0" + } + } + } + "File" + { + } + "FileType" + { + } + "Folder" + { + "{1525181F-901A-416C-8A58-119130FE478E}:_1D6B671D343A4228A354CA138B3705BD" + { + "Name" = "8:#1916" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:DesktopFolder" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_5CBF406C9E44415E87BBF1E35E297CB9" + { + "Name" = "8:#1919" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:ProgramMenuFolder" + "Folders" + { + } + } + "{3C67513D-01DD-4637-8A68-80971EB9504F}:_9B600ABCFF494174A956D068E6CF1046" + { + "DefaultLocation" = "8:[ProgramFiles64Folder][Manufacturer]\\[ProductName]" + "Name" = "8:#1925" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:TARGETDIR" + "Folders" + { + } + } + } + "LaunchCondition" + { + } + "Locator" + { + } + "MsiBootstrapper" + { + "LangId" = "3:1040" + "RequiresElevation" = "11:FALSE" + } + "Product" + { + "Name" = "8:Microsoft Visual Studio" + "ProductName" = "8:Log 4 Graylog" + "ProductCode" = "8:{AE9265EA-F205-4212-9A4A-C0AFD73A2067}" + "PackageCode" = "8:{688D543B-C948-42B2-9DBB-282E9C06868B}" + "UpgradeCode" = "8:{7CE09C91-3C26-4C8E-BC66-003536E12481}" + "AspNetVersion" = "8:4.0.30319.0" + "RestartWWWService" = "11:FALSE" + "RemovePreviousVersions" = "11:FALSE" + "DetectNewerInstalledVersion" = "11:TRUE" + "InstallAllUsers" = "11:TRUE" + "ProductVersion" = "8:1.0.0" + "Manufacturer" = "8:PAL s.r.l." + "ARPHELPTELEPHONE" = "8:" + "ARPHELPLINK" = "8:" + "Title" = "8:Log 4 Graylog" + "Subject" = "8:" + "ARPCONTACT" = "8:PAL s.r.l." + "Keywords" = "8:" + "ARPCOMMENTS" = "8:" + "ARPURLINFOABOUT" = "8:" + "ARPPRODUCTICON" = "8:" + "ARPIconIndex" = "3:0" + "SearchPath" = "8:" + "UseSystemSearchPath" = "11:TRUE" + "TargetPlatform" = "3:1" + "PreBuildEvent" = "8:" + "PostBuildEvent" = "8:" + "RunPostBuildEvent" = "3:0" + } + "Registry" + { + "HKLM" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_C849480FC9A34F619AFB777AB8058B8C" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_FB25222941BB463D82BF83B432229C92" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCU" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_9EEDADFE7F2A4D62822F476817E753E7" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_D1B544522F6F40F79D4C3F18C2A19672" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCR" + { + "Keys" + { + } + } + "HKU" + { + "Keys" + { + } + } + "HKPU" + { + "Keys" + { + } + } + } + "Sequences" + { + } + "Shortcut" + { + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_7FC43709505E4AD69D729799E1A9FD55" + { + "Name" = "8:Log 4 Graylog" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:32512" + "Transitive" = "11:FALSE" + "Target" = "8:_485C7AAA71924496B4CCA8F2B60EB371" + "Folder" = "8:_5CBF406C9E44415E87BBF1E35E297CB9" + "WorkingFolder" = "8:_9B600ABCFF494174A956D068E6CF1046" + "Icon" = "8:_485C7AAA71924496B4CCA8F2B60EB371" + "Feature" = "8:" + } + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_80AF6F01831346B88EC66109D1FF16DE" + { + "Name" = "8:Log 4 Graylog" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:32512" + "Transitive" = "11:FALSE" + "Target" = "8:_485C7AAA71924496B4CCA8F2B60EB371" + "Folder" = "8:_1D6B671D343A4228A354CA138B3705BD" + "WorkingFolder" = "8:_9B600ABCFF494174A956D068E6CF1046" + "Icon" = "8:_485C7AAA71924496B4CCA8F2B60EB371" + "Feature" = "8:" + } + } + "UserInterface" + { + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_058B586568DB4D688A57EEB398B06F16" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdUserInterface.wim" + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_2958DD0206804228973334D60F46090F" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdBasicDialogs.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_299C1A671A154ABEB03A4F99264ECFC4" + { + "Name" = "8:#1900" + "Sequence" = "3:1" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_2AB4BE6BE0394937B91721966F4AF4CE" + { + "Sequence" = "3:100" + "DisplayName" = "8:Introduzione" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_8312C2E278644B3B9959E0383611BD80" + { + "Sequence" = "3:300" + "DisplayName" = "8:Conferma installazione" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_835EB67B602745C6AC57FEF139B6EBA6" + { + "Sequence" = "3:200" + "DisplayName" = "8:Cartella di installazione" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "InstallAllUsersVisible" + { + "Name" = "8:InstallAllUsersVisible" + "DisplayName" = "8:#1059" + "Description" = "8:#1159" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_52CD5D3816D44C4AB5E4DE3ADE8422B6" + { + "Name" = "8:#1901" + "Sequence" = "3:2" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_4582CF2C8F7C4F9EBD5B2DFFB404EE46" + { + "Sequence" = "3:100" + "DisplayName" = "8:Stato" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_89D92D01F7024F92953EA8ED3504920E" + { + "Name" = "8:#1900" + "Sequence" = "3:2" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_07201741948546E091DA19D595D0AC1F" + { + "Sequence" = "3:300" + "DisplayName" = "8:Conferma installazione" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_27A58A37735A4611A418465FE6341E17" + { + "Sequence" = "3:200" + "DisplayName" = "8:Cartella di installazione" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_97C214765AEB41119F2A55C8787E53BF" + { + "Sequence" = "3:100" + "DisplayName" = "8:Introduzione" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_AF12ACB8499241C6BBE2C4696C8A93B6" + { + "Name" = "8:#1901" + "Sequence" = "3:1" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_157D503726C940A697F874FDE5D4041B" + { + "Sequence" = "3:100" + "DisplayName" = "8:Stato" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_BD0109A95F9E44CA8C691D410165FD50" + { + "Name" = "8:#1902" + "Sequence" = "3:1" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_E663914A875348A680F353D7ACECC165" + { + "Sequence" = "3:100" + "DisplayName" = "8:Installazione completata" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "UpdateText" + { + "Name" = "8:UpdateText" + "DisplayName" = "8:#1058" + "Description" = "8:#1158" + "Type" = "3:15" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1258" + "DefaultValue" = "8:#1258" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_F50B01AC406E4488B5583ACCD2C784D9" + { + "Name" = "8:#1902" + "Sequence" = "3:2" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_11BF88F7B9624E03BC06BDA926B92840" + { + "Sequence" = "3:100" + "DisplayName" = "8:Installazione completata" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + } + "MergeModule" + { + } + "ProjectOutput" + { + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_485C7AAA71924496B4CCA8F2B60EB371" + { + "SourcePath" = "8:..\\console_log4graylog\\obj\\Release\\net9.0\\apphost.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_9B600ABCFF494174A956D068E6CF1046" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:PublishItems" + "OutputProjectGuid" = "8:{D97CC845-BBC9-4683-9C99-C44050F3AD8B}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + } + } +} diff --git a/console_log4graylog.sln b/console_log4graylog.sln new file mode 100644 index 0000000..75c6617 --- /dev/null +++ b/console_log4graylog.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35707.178 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console_log4graylog", "console_log4graylog\console_log4graylog.csproj", "{D97CC845-BBC9-4683-9C99-C44050F3AD8B}" +EndProject +Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "(Setup) Log 4 Graylog", "(Setup) Log 4 Graylog\(Setup) Log 4 Graylog.vdproj", "{088E2DEB-3D70-42CA-A954-A81894611502}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D97CC845-BBC9-4683-9C99-C44050F3AD8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D97CC845-BBC9-4683-9C99-C44050F3AD8B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D97CC845-BBC9-4683-9C99-C44050F3AD8B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D97CC845-BBC9-4683-9C99-C44050F3AD8B}.Release|Any CPU.Build.0 = Release|Any CPU + {088E2DEB-3D70-42CA-A954-A81894611502}.Debug|Any CPU.ActiveCfg = Debug + {088E2DEB-3D70-42CA-A954-A81894611502}.Release|Any CPU.ActiveCfg = Release + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/console_log4graylog/Log-4-Graylog.ico b/console_log4graylog/Log-4-Graylog.ico new file mode 100644 index 0000000..ec99eaa Binary files /dev/null and b/console_log4graylog/Log-4-Graylog.ico differ diff --git a/console_log4graylog/Model/SettingsModel.cs b/console_log4graylog/Model/SettingsModel.cs new file mode 100644 index 0000000..dd40a39 --- /dev/null +++ b/console_log4graylog/Model/SettingsModel.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace console_log4graylog.Model +{ + public class SettingsModel + { + public GraylogSettings GraylogSettings { get; set; } + public GeneralSettings GeneralSettings { get; set; } + + } + + public class GraylogSettings + { + public string FQDN { get; set; } + public int Port { get; set; } + public string Facility { get; set; } + } + + public class GeneralSettings + { + public string DirPath { get; set; } + public string FileNamePattern { get; set; } + public string LogPath { get; set; } + } +} diff --git a/console_log4graylog/Program.cs b/console_log4graylog/Program.cs new file mode 100644 index 0000000..42cded4 --- /dev/null +++ b/console_log4graylog/Program.cs @@ -0,0 +1,56 @@ +using System.ServiceProcess; +using console_log4graylog.Model; +using console_log4graylog.Workers; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Serilog; +using Serilog.Core; +using Serilog.Events; +using Serilog.Sinks.Graylog; + +namespace console_log4graylog +{ + public static class Program + { + public static void Main(string[] args) + { + ServiceBase[] servicesToRun; + + IConfigurationRoot config = new ConfigurationBuilder() + .AddJsonFile("appsettings.json", + optional: true, + reloadOnChange: true) + .AddEnvironmentVariables() + .Build(); + + servicesToRun = new [] + { + new MainWorker(config) + }; + + var graylogSettings = config.GetSection("GraylogSettings").Get(); + + Log.Logger = new LoggerConfiguration() + .Enrich.With(new PalLogger()) + .WriteTo.Graylog(new GraylogSinkOptions + { + HostnameOrAddress = graylogSettings.FQDN, + Port = graylogSettings.Port, + MinimumLogEventLevel = LogEventLevel.Warning, + Facility = graylogSettings.Facility + }).CreateLogger(); + + ServiceBase.Run(servicesToRun); + } + } + + public class PalLogger : ILogEventEnricher + { + public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) + { + logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty("Username", Environment.UserName, true)); + } + } +} + diff --git a/console_log4graylog/Workers/MainWorker.cs b/console_log4graylog/Workers/MainWorker.cs new file mode 100644 index 0000000..b5109a1 --- /dev/null +++ b/console_log4graylog/Workers/MainWorker.cs @@ -0,0 +1,134 @@ +using console_log4graylog.Model; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.FileSystemGlobbing; +using Microsoft.Extensions.Hosting; +using Serilog; +using System.IO; +using System.Net; +using System.ServiceProcess; + +namespace console_log4graylog.Workers +{ + internal class MainWorker : ServiceBase + { + private SettingsModel Settings { get; set; } + private FileSystemWatcher watcher; + private Thread monitorThread; + private bool running = true; + + public MainWorker(IConfiguration _configuration) + { + Settings = new () + { + GeneralSettings = _configuration.GetSection("GeneralSettings").Get() + }; + } + + protected override void OnStart(string[] args) + { + Log2File("Start Log 4 Graylog"); + Log.Logger.Warning("▶️ Start Log 4 Graylog on " + Dns.GetHostName()); + + + monitorThread = new Thread(MonitorFolder); + monitorThread.Start(); + } + + protected override void OnStop() + { + Log2File("End Log 4 Graylog"); + Log.Logger.Error("⏹️ End Log 4 Graylog on " + Dns.GetHostName()); + + running = false; + watcher?.Dispose(); + } + + private void MonitorFolder() + { + while (running) + { + try + { + var latestFile = GetLatestLogFile(); + if (latestFile != null) + { + MonitorLogFile(latestFile); + } + Thread.Sleep(1000); + } + catch (Exception ex) + { + LogError("Service encountered an error: " + ex.Message); + } + } + } + + private FileInfo GetLatestLogFile() + { + DirectoryInfo dir = new DirectoryInfo(Settings.GeneralSettings.DirPath); + return dir.GetFiles(Settings.GeneralSettings.FileNamePattern) + .OrderByDescending(f => f.LastWriteTime) + .FirstOrDefault(); + } + + private void MonitorLogFile(FileInfo file) + { + try + { + Log2File("Attach to file: " + file.FullName); + Log.Logger.Warning("🗂️ Attach to file: " + file.FullName); + using (var fs = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + using (var reader = new StreamReader(fs)) + { + reader.BaseStream.Seek(0, SeekOrigin.End); + while (running) + { + string line = reader.ReadLine(); + while (line != null) + { + Log.Logger.Warning(line); + line = reader.ReadLine(); + } + if (GetLatestLogFile()?.FullName != file.FullName) + { + break; + } + Thread.Sleep(500); + } + } + } + catch (Exception ex) + { + LogError("Error monitoring file: " + ex.Message); + } + } + + + private void LogError(string errorMessage) + { + Log2File(errorMessage); + Log.Logger.Error("⚠️ " + errorMessage); + + throw new Exception(errorMessage); + } + + private void Log2File(string message) + { + if (!Directory.Exists(Path.GetDirectoryName(Settings.GeneralSettings.LogPath))) + { + Directory.CreateDirectory(Path.GetDirectoryName(Settings.GeneralSettings.LogPath)); + } + + if (!File.Exists(Settings.GeneralSettings.LogPath)) + { + using (FileStream fs = File.Create(Settings.GeneralSettings.LogPath)) + { + byte[] info = new System.Text.UTF8Encoding(true).GetBytes(""); + fs.Write(info, 0, info.Length); + } + } + + File.AppendAllText(Settings.GeneralSettings.LogPath, DateTime.Now + " - " + message + "\n"); + } + } +} diff --git a/console_log4graylog/appsettings.json b/console_log4graylog/appsettings.json new file mode 100644 index 0000000..67f14c3 --- /dev/null +++ b/console_log4graylog/appsettings.json @@ -0,0 +1,12 @@ +{ + "GraylogSettings" : { + "FQDN" : "graylog.local", + "Port" : 12202, + "Facility" : "ConsoleApp" + }, + "GeneralSettings" : { + "DirPath" : "C:\\Logs", + "FileNamePattern": "*.log", + "LogPath": "C:\\Logs\\l4g_debug.log" + } +} diff --git a/console_log4graylog/console_log4graylog.csproj b/console_log4graylog/console_log4graylog.csproj new file mode 100644 index 0000000..889fded --- /dev/null +++ b/console_log4graylog/console_log4graylog.csproj @@ -0,0 +1,39 @@ + + + + Exe + net9.0 + enable + enable + Log-4-Graylog.ico + + + + none + + + + none + + + + + Always + + + + + + + + + + + + + + Always + + + +