v 1.0.3 - on setup automaticaly add the service and start it
This commit is contained in:
@@ -21,10 +21,22 @@
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_4F69E6F677D2494E9E867224E3551233"
|
||||
"MsmKey" = "8:_8F56FA697AF246D1984287C0CF6F963D"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_DBAC22F7925D4A24B0D64C4D570A4B6F"
|
||||
"OwnerKey" = "8:_UNDEFINED"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
"Entry"
|
||||
{
|
||||
"MsmKey" = "8:_UNDEFINED"
|
||||
"OwnerKey" = "8:_DBAC22F7925D4A24B0D64C4D570A4B6F"
|
||||
"MsmSig" = "8:_UNDEFINED"
|
||||
}
|
||||
}
|
||||
"Configurations"
|
||||
{
|
||||
@@ -97,6 +109,62 @@
|
||||
{
|
||||
"CustomAction"
|
||||
{
|
||||
"{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_0843631901554DAC83709FFCF1649025"
|
||||
{
|
||||
"Name" = "8:serviceInstaller.dll"
|
||||
"Condition" = "8:"
|
||||
"Object" = "8:_DBAC22F7925D4A24B0D64C4D570A4B6F"
|
||||
"FileType" = "3:1"
|
||||
"InstallAction" = "3:3"
|
||||
"Arguments" = "8:"
|
||||
"EntryPoint" = "8:"
|
||||
"Sequence" = "3:1"
|
||||
"Identifier" = "8:_C744F9D4_F4BB_4DCA_B07E_97AD95BCF80F"
|
||||
"InstallerClass" = "11:TRUE"
|
||||
"CustomActionData" = "8:"
|
||||
}
|
||||
"{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_0B3A29897E854DEFB7A6A4452928C16F"
|
||||
{
|
||||
"Name" = "8:serviceInstaller.dll"
|
||||
"Condition" = "8:"
|
||||
"Object" = "8:_DBAC22F7925D4A24B0D64C4D570A4B6F"
|
||||
"FileType" = "3:1"
|
||||
"InstallAction" = "3:1"
|
||||
"Arguments" = "8:"
|
||||
"EntryPoint" = "8:"
|
||||
"Sequence" = "3:1"
|
||||
"Identifier" = "8:_C19353EA_6BF6_4096_96A2_E4E3AEBAFED4"
|
||||
"InstallerClass" = "11:TRUE"
|
||||
"CustomActionData" = "8:"
|
||||
}
|
||||
"{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_A67595795DDE4586B20445A58C366A4D"
|
||||
{
|
||||
"Name" = "8:serviceInstaller.dll"
|
||||
"Condition" = "8:"
|
||||
"Object" = "8:_DBAC22F7925D4A24B0D64C4D570A4B6F"
|
||||
"FileType" = "3:1"
|
||||
"InstallAction" = "3:2"
|
||||
"Arguments" = "8:"
|
||||
"EntryPoint" = "8:"
|
||||
"Sequence" = "3:1"
|
||||
"Identifier" = "8:_7FB0B943_18FC_4169_977C_FB0E26458945"
|
||||
"InstallerClass" = "11:TRUE"
|
||||
"CustomActionData" = "8:"
|
||||
}
|
||||
"{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_EA6E62AD519E4C989C26EED7A86F1990"
|
||||
{
|
||||
"Name" = "8:serviceInstaller.dll"
|
||||
"Condition" = "8:"
|
||||
"Object" = "8:_DBAC22F7925D4A24B0D64C4D570A4B6F"
|
||||
"FileType" = "3:1"
|
||||
"InstallAction" = "3:4"
|
||||
"Arguments" = "8:"
|
||||
"EntryPoint" = "8:"
|
||||
"Sequence" = "3:1"
|
||||
"Identifier" = "8:_E99DE823_7220_4E56_BD53_383C00AB00E2"
|
||||
"InstallerClass" = "11:TRUE"
|
||||
"CustomActionData" = "8:"
|
||||
}
|
||||
}
|
||||
"DefaultFeature"
|
||||
{
|
||||
@@ -118,14 +186,53 @@
|
||||
"Architecture" = "2:0"
|
||||
"Runtime" = "2:0"
|
||||
}
|
||||
"{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_3A525A75C262405F97EE6EAD26B5B0EA"
|
||||
{
|
||||
"Name" = "8:.NET Framework"
|
||||
"Message" = "8:[VSDNETMSG]"
|
||||
"FrameworkVersion" = "8:.NETFramework,Version=v4.7.2"
|
||||
"AllowLaterVersions" = "11:FALSE"
|
||||
"InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=863262"
|
||||
}
|
||||
}
|
||||
}
|
||||
"File"
|
||||
{
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_4F69E6F677D2494E9E867224E3551233"
|
||||
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_8F56FA697AF246D1984287C0CF6F963D"
|
||||
{
|
||||
"SourcePath" = "8:..\\console_log4graylog\\Log_4_Graylog.ico"
|
||||
"TargetName" = "8:Log_4_Graylog.ico"
|
||||
"SourcePath" = "8:..\\console_log4graylog\\Resource\\Log4Graylog.ico"
|
||||
"TargetName" = "8:Log4Graylog.ico"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_9B600ABCFF494174A956D068E6CF1046"
|
||||
"Condition" = "8:"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Vital" = "11:TRUE"
|
||||
"ReadOnly" = "11:FALSE"
|
||||
"Hidden" = "11:TRUE"
|
||||
"System" = "11:FALSE"
|
||||
"Permanent" = "11:FALSE"
|
||||
"SharedLegacy" = "11:FALSE"
|
||||
"PackageAs" = "3:1"
|
||||
"Register" = "3:1"
|
||||
"Exclude" = "11:FALSE"
|
||||
"IsDependency" = "11:FALSE"
|
||||
"IsolateTo" = "8:"
|
||||
}
|
||||
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_DBAC22F7925D4A24B0D64C4D570A4B6F"
|
||||
{
|
||||
"AssemblyRegister" = "3:1"
|
||||
"AssemblyIsInGAC" = "11:FALSE"
|
||||
"AssemblyAsmDisplayName" = "8:serviceInstaller, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"
|
||||
"ScatterAssemblies"
|
||||
{
|
||||
"_DBAC22F7925D4A24B0D64C4D570A4B6F"
|
||||
{
|
||||
"Name" = "8:serviceInstaller.dll"
|
||||
"Attributes" = "3:512"
|
||||
}
|
||||
}
|
||||
"SourcePath" = "8:..\\serviceInstaller\\bin\\Release\\serviceInstaller.dll"
|
||||
"TargetName" = "8:"
|
||||
"Tag" = "8:"
|
||||
"Folder" = "8:_9B600ABCFF494174A956D068E6CF1046"
|
||||
"Condition" = "8:"
|
||||
@@ -198,15 +305,15 @@
|
||||
{
|
||||
"Name" = "8:Microsoft Visual Studio"
|
||||
"ProductName" = "8:Log 4 Graylog"
|
||||
"ProductCode" = "8:{E73F35BF-F750-4609-A786-958CE5C83DE7}"
|
||||
"PackageCode" = "8:{558BC65A-00BF-4BBE-A6DC-C9AB352A4690}"
|
||||
"ProductCode" = "8:{D843EA28-6AD4-4B10-9BA6-8878E0C1E174}"
|
||||
"PackageCode" = "8:{40BF9EDE-7902-4C62-B536-E0C13CC890EF}"
|
||||
"UpgradeCode" = "8:{7CE09C91-3C26-4C8E-BC66-003536E12481}"
|
||||
"AspNetVersion" = "8:4.0.30319.0"
|
||||
"RestartWWWService" = "11:FALSE"
|
||||
"RemovePreviousVersions" = "11:TRUE"
|
||||
"DetectNewerInstalledVersion" = "11:TRUE"
|
||||
"InstallAllUsers" = "11:TRUE"
|
||||
"ProductVersion" = "8:1.0.2"
|
||||
"ProductVersion" = "8:1.0.3"
|
||||
"Manufacturer" = "8:PAL s.r.l."
|
||||
"ARPHELPTELEPHONE" = "8:"
|
||||
"ARPHELPLINK" = "8:"
|
||||
@@ -216,7 +323,7 @@
|
||||
"Keywords" = "8:"
|
||||
"ARPCOMMENTS" = "8:"
|
||||
"ARPURLINFOABOUT" = "8:https://www.imalpal.com/en/"
|
||||
"ARPPRODUCTICON" = "8:_4F69E6F677D2494E9E867224E3551233"
|
||||
"ARPPRODUCTICON" = "8:_8F56FA697AF246D1984287C0CF6F963D"
|
||||
"ARPIconIndex" = "3:0"
|
||||
"SearchPath" = "8:"
|
||||
"UseSystemSearchPath" = "11:TRUE"
|
||||
@@ -319,34 +426,6 @@
|
||||
}
|
||||
"Shortcut"
|
||||
{
|
||||
"{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_0AC95449D7BB49C294086916871E955F"
|
||||
{
|
||||
"Name" = "8:Log 4 Graylog"
|
||||
"Arguments" = "8:"
|
||||
"Description" = "8:"
|
||||
"ShowCmd" = "3:1"
|
||||
"IconIndex" = "3:0"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Target" = "8:_485C7AAA71924496B4CCA8F2B60EB371"
|
||||
"Folder" = "8:_5CBF406C9E44415E87BBF1E35E297CB9"
|
||||
"WorkingFolder" = "8:_9B600ABCFF494174A956D068E6CF1046"
|
||||
"Icon" = "8:_4F69E6F677D2494E9E867224E3551233"
|
||||
"Feature" = "8:"
|
||||
}
|
||||
"{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_7D574C8D097B44558FBEBD9AF12F9D46"
|
||||
{
|
||||
"Name" = "8:Log 4 Graylog"
|
||||
"Arguments" = "8:"
|
||||
"Description" = "8:"
|
||||
"ShowCmd" = "3:1"
|
||||
"IconIndex" = "3:0"
|
||||
"Transitive" = "11:FALSE"
|
||||
"Target" = "8:_485C7AAA71924496B4CCA8F2B60EB371"
|
||||
"Folder" = "8:_1D6B671D343A4228A354CA138B3705BD"
|
||||
"WorkingFolder" = "8:_9B600ABCFF494174A956D068E6CF1046"
|
||||
"Icon" = "8:_4F69E6F677D2494E9E867224E3551233"
|
||||
"Feature" = "8:"
|
||||
}
|
||||
}
|
||||
"UserInterface"
|
||||
{
|
||||
|
||||
@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console_log4graylog", "cons
|
||||
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
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "serviceInstaller", "serviceInstaller\serviceInstaller.csproj", "{2640AD9B-527F-49F4-B140-62CDFD6BE532}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -19,6 +21,10 @@ Global
|
||||
{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
|
||||
{2640AD9B-527F-49F4-B140-62CDFD6BE532}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2640AD9B-527F-49F4-B140-62CDFD6BE532}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2640AD9B-527F-49F4-B140-62CDFD6BE532}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2640AD9B-527F-49F4-B140-62CDFD6BE532}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# <img src="Log-4-Graylog.ico" width="50" height="50"> Log4Graylog
|
||||
# Log4Graylog
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
Service for monitoring and sending log files to Graylog
|
||||
Service for monitoring and sending log files to Graylog.
|
||||
|
||||
## AppSettings
|
||||
|
||||
@@ -79,14 +79,3 @@ Path to the folder where the file to be monitored is located
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
## Run as Services
|
||||
|
||||
**Powershell**
|
||||
```
|
||||
New-Service -Name "Log4Graylog" `
|
||||
-BinaryPathName "C:\Program Files\PAL s.r.l\Log 4 Graylog\console_log4graylog.exe" `
|
||||
-DisplayName "Log 4 Graylog" `
|
||||
-Description "Servizio per il monitoring ed invio dei file di log a Graylog" `
|
||||
-StartupType Automatic
|
||||
```
|
||||
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
@@ -5,7 +5,7 @@
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<ApplicationIcon>Log_4_Graylog.ico</ApplicationIcon>
|
||||
<ApplicationIcon>Resource\Log4Graylog.ico</ApplicationIcon>
|
||||
<NuGetAuditLevel>critical</NuGetAuditLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Log_4_Graylog.ico">
|
||||
<Content Include="Resource\Log4Graylog.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using System.ComponentModel;
|
||||
using System.Configuration.Install;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.ServiceProcess;
|
||||
|
||||
namespace serviceInstaller
|
||||
{
|
||||
[RunInstaller(true)]
|
||||
public class ProjectInstaller : Installer
|
||||
{
|
||||
private ServiceProcessInstaller processInstaller;
|
||||
private ServiceInstaller serviceInstaller;
|
||||
|
||||
public ProjectInstaller()
|
||||
{
|
||||
processInstaller = new ServiceProcessInstaller
|
||||
{
|
||||
Account = ServiceAccount.LocalSystem
|
||||
};
|
||||
|
||||
serviceInstaller = new ServiceInstaller
|
||||
{
|
||||
ServiceName = "Log4GraylogService",
|
||||
DisplayName = "Log 4 Graylog Service",
|
||||
Description = "Service for monitoring and sending log files to Graylog",
|
||||
StartType = ServiceStartMode.Automatic
|
||||
};
|
||||
|
||||
Installers.Add(processInstaller);
|
||||
Installers.Add(serviceInstaller);
|
||||
}
|
||||
|
||||
public override void Install(System.Collections.IDictionary stateSaver)
|
||||
{
|
||||
base.Install(stateSaver);
|
||||
|
||||
string assemblyPath = Context.Parameters["assemblypath"];
|
||||
string exePath = Path.Combine(Path.GetDirectoryName(assemblyPath), "console_log4graylog.exe");
|
||||
|
||||
using (ServiceController sc = new ServiceController(serviceInstaller.ServiceName))
|
||||
{
|
||||
if (sc.Status == ServiceControllerStatus.Stopped)
|
||||
{
|
||||
Process.Start("sc", $"config \"{serviceInstaller.ServiceName}\" binPath= \"{exePath}\"");
|
||||
Process.Start("sc", $"start \"{serviceInstaller.ServiceName}\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Le informazioni generali relative a un assembly sono controllate dal seguente
|
||||
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
|
||||
// associate a un assembly.
|
||||
[assembly: AssemblyTitle("serviceInstaller")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("serviceInstaller")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
|
||||
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
|
||||
// COM, impostare su true l'attributo ComVisible per tale tipo.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
|
||||
[assembly: Guid("2640ad9b-527f-49f4-b140-62cdfd6be532")]
|
||||
|
||||
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
|
||||
//
|
||||
// Versione principale
|
||||
// Versione secondaria
|
||||
// Numero di build
|
||||
// Revisione
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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>{2640AD9B-527F-49F4-B140-62CDFD6BE532}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>serviceInstaller</RootNamespace>
|
||||
<AssemblyName>serviceInstaller</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<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' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<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="ProjectInstaller.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user