-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added AWS EC2 Windows datasource. - Added configurations - Fixed typo in aws ec2 linux test configuration.
- Loading branch information
Showing
18 changed files
with
2,044 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"name": "AWS", | ||
"logo": "https://dytvr9ot2sszz.cloudfront.net/logz-docs/shipper-logos/aws.svg", | ||
"description": "", | ||
"hint": "Select the environment where you want to deploy Logz.io Telemetry Collector.", | ||
"subtypes": [ | ||
{ | ||
"name": "EC2", | ||
"logo": "https://dytvr9ot2sszz.cloudfront.net/logz-docs/shipper-logos/aws.png", | ||
"description": "EC2 Windows server", | ||
"hint": "EC2 with Windows.", | ||
"supportedOs": ["Windows"], | ||
"datasources": [ | ||
{ | ||
"name": "System", | ||
"logo": "https://dytvr9ot2sszz.cloudfront.net/logz-docs/shipper-logos/local_host.png", | ||
"label": "System", | ||
"description": "Logz.io Uses OpenTelemetry to monitor your computer.", | ||
"telemetries": [ | ||
{ | ||
"type": "LOG_ANALYTICS", | ||
"hint": "Switch the toggle on if you want Logz.io Telemetry Collector to collect logs from your computer.", | ||
"otel": { | ||
"receivers": ["filelog","windowseventlog_application","windowseventlog_security","windowseventlog_system"], | ||
"processors": ["resourcedetection_system", "resourcedetection_ec2"] | ||
}, | ||
"params": | ||
[ | ||
{ | ||
"type": "string-list", | ||
"name": "logSources", | ||
"label": "Location of your logs", | ||
"placeholder": "i.e. C:\\Users\\my_example\\Documents\\*.txt", | ||
"description": "The paths of log files to collect.", | ||
"hint": "By adding paths, OpenTelemetry will read logs from these log paths and will export them to Logz.io.", | ||
"value": ["C:\\Users\\Administrator\\Documents\\*.log"] }, | ||
{ | ||
"type": "boolean", | ||
"name": "isApplicationLog", | ||
"label": "Collect logs from Windows event logs application channel", | ||
"description": "", | ||
"hint": "By checking this option, OpenTelemetry will collect logs from Windows event logs application channel.", | ||
"value": true | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "isSecurityLog", | ||
"label": "Collect logs from Windows event logs security channel", | ||
"description": "", | ||
"hint": "By checking this option, OpenTelemetry will collect logs from Windows event logs security channel.", | ||
"value": true | ||
}, | ||
{ | ||
"type": "boolean", | ||
"name": "isSystemLog", | ||
"label": "Collect logs from Windows event logs system channel", | ||
"description": "", | ||
"hint": "By checking this option, OpenTelemetry will collect logs from windows event logs system channel.", | ||
"value": true | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "METRICS", | ||
"hint": "Switch the toggle on if you want Logz.io Telemetry Collector to collect metrics from your computer.", | ||
"otel": { | ||
"receivers": ["hostmetrics"], | ||
"processors": ["resourcedetection_system", "resourc_agent", "filter", "resourcedetection_ec2"] | ||
|
||
}, | ||
"params": [], | ||
"dashboards": [ | ||
"7vydxtpnlKLILHIGK4puX5" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
################################################################################################################################# | ||
################################################## WINDOWS Agent Info Script #################################################### | ||
################################################################################################################################# | ||
|
||
Write-Host | ||
Write-Host '###################' | ||
Write-Host '### ' -NoNewline | ||
Write-Host 'Information' -ForegroundColor Magenta -NoNewline | ||
Write-Host ' ###' | ||
Write-Host '###################' | ||
Write-Host 'Collector Binary' -ForegroundColor Magenta -NoNewLine | ||
Write-Host ": $script:OtelCollectorExe" | ||
Write-Host 'Collector Config' -ForegroundColor Magenta -NoNewLine | ||
Write-Host ": $script:OtelConfig" | ||
Write-Host 'Logz.io Agent Logs' -ForegroundColor Magenta -NoNewLine | ||
Write-Host ": $script:AgentLogFile" | ||
Write-Host 'Start Service' -ForegroundColor Magenta -NoNewLine | ||
Write-Host ": Start-Service -Name $script:LogzioOtelCollectorServiceName" | ||
Write-Host 'Stop Service' -ForegroundColor Magenta -NoNewLine | ||
Write-Host ": Stop-Service -Name $script:LogzioOtelCollectorServiceName" | ||
Write-Host 'Delete Service' -ForegroundColor Magenta -NoNewLine | ||
Write-Host ": sc.exe DELETE $script:LogzioOtelCollectorServiceName (stop the service before deleting it)" | ||
Write-Host 'Show Service' -ForegroundColor Magenta -NoNewLine | ||
Write-Host ": Get-Service -Name $script:LogzioOtelCollectorServiceName" | ||
Write-Host 'Show Service Logs' -ForegroundColor Magenta -NoNewLine | ||
Write-Host ": eventvwr.msc ('Windows Logs'->'Application' all logs with source '$script:LogzioOtelCollectorServiceName')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
################################################################################################################################# | ||
############################################# WINDOWS Subtype Installer Functions ############################################### | ||
################################################################################################################################# | ||
|
||
# Checks if Logz.io OTEL collector service exists | ||
# Input: | ||
# --- | ||
# Output: | ||
# IsServiceExist - Tells if Logz.io OTEL collector service exists (true/false) | ||
function Get-IsLogzioOtelCollectorServiceExist { | ||
$local:FuncName = $MyInvocation.MyCommand.Name | ||
|
||
$local:Message = 'Checking if Logz.io OTEL collector service exists ...' | ||
Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepPreInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-Log $LogLevelDebug $Message | ||
|
||
$local:Service = Get-Service -Name $script:LogzioOtelCollectorServiceName -ErrorAction SilentlyContinue | ||
if ([string]::IsNullOrEmpty($Service)) { | ||
$Message = "'$script:LogzioOtelCollectorServiceName' service does not exist" | ||
Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepPreInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-Log $script:LogLevelDebug $Message | ||
|
||
Write-TaskPostRun "`$script:IsServiceExist = `$false" | ||
return | ||
} | ||
|
||
$Message = "'$script:LogzioOtelCollectorServiceName' service is already exists" | ||
Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepPreInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-Log $script:LogLevelDebug $Message | ||
|
||
Write-TaskPostRun "`$script:IsServiceExist = `$true" | ||
} | ||
|
||
# Deletes Logz.io OTEL collector service | ||
# Input: | ||
# --- | ||
# Output: | ||
# --- | ||
function Remove-LogzioOtelCollectorService { | ||
$local:ExitCode = 1 | ||
$local:FuncName = $MyInvocation.MyCommand.Name | ||
|
||
$local:Message = 'Removing Logz.io OTEL collector service ...' | ||
Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepPreInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-Log $script:LogLevelDebug $Message | ||
|
||
try { | ||
Stop-Service -Name $script:LogzioOtelCollectorServiceName -ErrorAction Stop | Out-Null | ||
} | ||
catch { | ||
$Message = "installer.ps1 ($ExitCode): error stopping '$script:LogzioOtelCollectorServiceName' service: $_" | ||
Send-LogToLogzio $script:LogLevelError $Message $script:LogStepPreInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-TaskPostRun "Write-Error `"$Message`"" | ||
} | ||
|
||
sc.exe DELETE $script:LogzioOtelCollectorServiceName 2>$script:TaskErrorFile | Out-Null | ||
if ($LASTEXITCODE -ne 0) { | ||
$Message = "installer.ps1 ($ExitCode): error deleting '$script:LogzioOtelCollectorServiceName' service: $(Get-TaskErrorMessage)" | ||
Send-LogToLogzio $script:LogLevelError $Message $script:LogStepPreInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-TaskPostRun "Write-Error `"$Message`"" | ||
|
||
return $ExitCode | ||
} | ||
} | ||
|
||
# Downloads OTEL collector exe | ||
# Input: | ||
# --- | ||
# Output: | ||
# OTEL collector exe in Logz.io temp directory | ||
function Get-OtelCollectorExe { | ||
$local:ExitCode = 2 | ||
$local:FuncName = $MyInvocation.MyCommand.Name | ||
|
||
$local:Message = 'Downloading OTEL collector exe ...' | ||
Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepPreInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-Log $script:LogLevelDebug $Message | ||
|
||
try { | ||
Invoke-WebRequest -Uri $script:OtelCollectorUrlDownload -OutFile "$script:LogzioTempDir\otelcol-logzio.zip" | Out-Null | ||
} | ||
catch { | ||
$Message = "installer.ps1 ($ExitCode): error downloading OTEL collector zip: $_" | ||
Send-LogToLogzio $script:LogLevelError $Message $script:LogStepPreInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-TaskPostRun "Write-Error `"$Message`"" | ||
|
||
return $ExitCode | ||
} | ||
|
||
try { | ||
Expand-Archive -LiteralPath "$script:LogzioTempDir\otelcol-logzio.zip" -DestinationPath $script:LogzioTempDir -Force | Out-Null | ||
} | ||
catch { | ||
$Message = "installer.ps1 ($ExitCode): error extracting files from zip: $_" | ||
Send-LogToLogzio $script:LogLevelError $Message $script:LogStepPreInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-TaskPostRun "Write-Error `"$Message`"" | ||
|
||
return $ExitCode | ||
} | ||
} | ||
|
||
# Creates Logz.io AppData subdirectory | ||
# Input: | ||
# --- | ||
# Output: | ||
# --- | ||
function New-LogzioAppDataSubDir { | ||
$local:ExitCode = 3 | ||
$local:FuncName = $MyInvocation.MyCommand.Name | ||
|
||
$local:Message = 'Creating Logz.io AppData subdirectory ...' | ||
Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-Log $script:LogLevelDebug $Message | ||
|
||
try { | ||
New-Item -Path $script:LogzioOtelCollectorDir -ItemType Directory -Force -ErrorAction Stop | Out-Null | ||
} | ||
catch { | ||
$Message = "installer.ps1 ($ExitCode): error creating Logz.io OTEL collector directory: $_" | ||
Send-LogToLogzio $script:LogLevelError $Message $script:LogStepInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-TaskPostRun "Write-Error `"$Message`"" | ||
|
||
return $ExitCode | ||
} | ||
} | ||
|
||
# Copies OTEL files to AppData subdirectory | ||
# Input: | ||
# --- | ||
# Output: | ||
# --- | ||
function Copy-LogzioOtelFilesToAppDataSubDir { | ||
$local:ExitCode = 4 | ||
$local:FuncName = $MyInvocation.MyCommand.Name | ||
|
||
$local:Message = 'Copying Logz.io OTEL files to AppData subdirectory ...' | ||
Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-Log $script:LogLevelDebug $Message | ||
|
||
try { | ||
Copy-Item -Path "$script:LogzioTempDir\$script:OtelCollectorExeName" -Destination $script:LogzioOtelCollectorDir -Force -ErrorAction Stop | ||
Copy-Item -Path "$script:OtelResourcesDir\$script:OtelConfigName" -Destination $script:LogzioOtelCollectorDir -Force -ErrorAction Stop | ||
} | ||
catch { | ||
$Message = "installer.ps1 ($ExitCode): error copying OTEL files to AppData subdirectory: $_" | ||
Send-LogToLogzio $script:LogLevelError $Message $script:LogStepInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-TaskPostRun "Write-Error `"$Message`"" | ||
|
||
return $ExitCode | ||
} | ||
} | ||
|
||
# Runs Logz.io OTEL collector service | ||
# Input: | ||
# --- | ||
# Output: | ||
# --- | ||
function Invoke-LogzioOtelCollectorService { | ||
$local:ExitCode = 5 | ||
$local:FuncName = $MyInvocation.MyCommand.Name | ||
|
||
$local:Message = 'Running Logz.io OTEL collector service ...' | ||
Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-Log $script:LogLevelDebug $Message | ||
$Message = Get-Content -Path $script:OtelConfig | ||
Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-Log $script:LogLevelDebug $Message | ||
|
||
try { | ||
New-Service -Name $script:LogzioOtelCollectorServiceName -BinaryPathName "$script:OtelCollectorExe --config $script:OtelConfig" -Description "Collects localhost logs/metrics and sends them to Logz.io." -ErrorAction Stop | Out-Null | ||
} | ||
catch { | ||
$Message = "installer.ps1 ($ExitCode): error creating '$script:LogzioOtelCollectorServiceName' service: $_" | ||
Send-LogToLogzio $script:LogLevelError $Message $script:LogStepInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-TaskPostRun "Write-Error `"$Message`"" | ||
|
||
sc.exe DELETE LogzioOTELCollector 2>$script:TaskErrorFile | Out-Null | ||
if ($LASTEXITCODE -ne 0) { | ||
$Message = "installer.ps1 ($ExitCode): error deleting '$script:LogzioOtelCollectorServiceName' service: $(Get-TaskErrorMessage)" | ||
Send-LogToLogzio $script:LogLevelError $Message $script:LogStepInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-TaskPostRun "Write-Warning `"$Message`"" | ||
} | ||
|
||
return $ExitCode | ||
} | ||
|
||
try { | ||
Start-Service -Name $script:LogzioOtelCollectorServiceName -ErrorAction Stop | Out-Null | ||
} | ||
catch { | ||
$Message = "installer.ps1 ($ExitCode): error starting '$script:LogzioOtelCollectorServiceName' service: $_" | ||
Send-LogToLogzio $script:LogLevelError $Message $script:LogStepInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-TaskPostRun "Write-Error `"$Message`"" | ||
|
||
sc.exe DELETE LogzioOTELCollector 2>$script:TaskErrorFile | Out-Null | ||
if ($LASTEXITCODE -ne 0) { | ||
$Message = "installer.ps1 ($ExitCode): error deleting '$script:LogzioOtelCollectorServiceName' service: $(Get-TaskErrorMessage)" | ||
Send-LogToLogzio $script:LogLevelError $Message $script:LogStepInstallation $script:LogScriptInstaller $FuncName $script:AgentId $script:Platform $script:Subtype | ||
Write-TaskPostRun "Write-Warning `"$Message`"" | ||
} | ||
|
||
return $ExitCode | ||
} | ||
} |
Oops, something went wrong.