Skip to content

Commit

Permalink
Windows localhost (#25)
Browse files Browse the repository at this point in the history
* prerequisites

* installer

* fix comment

* fix comment

* fix log

* add windows localhost config

* bool required test

* installer

* add supportedOs

* remove required

* logs

* installer

* metrics

* logs

* add title

* fix connection tests

* fix appdata dir

* fix log sources empty

* fix log sources empty

* add script before vars

* add if

* fix using var

* fix selected logs

* fix yq appenders

* fix yq appenders

* fix yq appenders

* fix yq appenders

* fix yq

* fix yq

* fix yq

* fix file

* use otel distro

* service

* add information

* delete existing otel bin

* otel logs

* otel logs

* add title

* update dashboards

* remove batch
  • Loading branch information
ShiranAvidov authored Aug 15, 2022
1 parent 20884d4 commit 7a3f0bd
Show file tree
Hide file tree
Showing 22 changed files with 1,080 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Build-LogzioTracesTokenHelmSet {
# Output:
# helmSets - Contains all the Helm sets
# Error:
# Error Code 2
# Exit Code 2
function Build-LogzioRegionHelmSet {
. $using:logzioTempDir\utils_functions.ps1
$local:logFile = $using:logFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Build-LogzioTracesTokenHelmSet {
# Output:
# helmSets - Contains all the Helm sets
# Error:
# Error Code 2
# Exit Code 2
function Build-LogzioRegionHelmSet {
. $using:logzioTempDir\utils_functions.ps1
$local:logFile = $using:logFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function Build-LogzioTracesTokenHelmSet {
# Output:
# helmSets - Contains all the Helm sets
# Error:
# Error Code 2
# Exit Code 2
function Build-LogzioRegionHelmSet {
. $using:logzioTempDir\utils_functions.ps1
$local:logFile = $using:logFile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function get_metrics_scripts () {
fi
}

# Run Logz.io OTEL collector service
# Runs Logz.io OTEL collector service
# Error:
# Exit Code 7
function run_logzio_otel_collector_service () {
Expand Down
7 changes: 2 additions & 5 deletions Localhost/Mac/System/telemetry/installer/otel_config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
receivers:
processors:
batch:
send_batch_size: 10000
timeout: 5s
resourcedetection/system:
detectors: ["system"]
system:
Expand All @@ -13,11 +10,11 @@ service:
pipelines:
logs:
receivers: []
processors: [batch, resourcedetection/system]
processors: [resourcedetection/system]
exporters: []
metrics:
receivers: []
processors: [batch, resourcedetection/system]
processors: [resourcedetection/system]
exporters: []
telemetry:
logs:
Expand Down
2 changes: 1 addition & 1 deletion Localhost/Mac/System/telemetry/logs/mac/functions.bash
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function get_logzio_logs_token () {
# Error:
# Exit Code 3
function get_log_sources () {
write_log "INFO" "Getting log_paths ..."
write_log "INFO" "Getting log sources ..."

local log_sources_param=$(find_param "$logs_params" "logSources")
if [[ -z "$log_sources_param" ]]; then
Expand Down
81 changes: 81 additions & 0 deletions Localhost/Windows/System/prerequisites/windows/functions.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#################################################################################################################################
############################################### Prerequisites Windows Functions #################################################
#################################################################################################################################

# Installs yq
# Error:
# Exit Code 1
function Install-YQ {
. $using:logzioTempDir\utils_functions.ps1
$local:logFile = $using:logFile
$local:runFile = $using:runFile
$local:taskErrorFile = $using:taskErrorFile

Write-Log "INFO" "Checking if yq is installed ..."

Get-Command yq 2>&1 | Out-Null
if ($?) {
return
}

$local:result = Install-Chocolatey
if (-Not [string]::IsNullOrEmpty($result) -and $result -gt 0) {
return 1
}

Write-Log "INFO" "Installing yq ..."
choco install yq -y 2>$using:taskErrorFile | Out-Null
if ($?) {
return
}

$local:err = Get-TaskError
Write-Run "Write-Error `"prerequisites.ps1 (1): failed to install yq.`n $err`""
return 1
}

# Checks if localhost can connect to Logz.io logs (port 8071)
# Error:
# Exit Code 2
function Test-CanLocalhostConnectToLogzioLogs {
. $using:logzioTempDir\utils_functions.ps1
$local:logFile = $using:logFile
$local:runFile = $using:runFile

Write-Log "INFO" "Checking if localhost can connect to Logz.io logs (port 8071) ..."

$ProgressPreference = "SilentlyContinue"
$WarningPreference = "SilentlyContinue"
$local:result = Test-NetConnection -ComputerName listener.logz.io -Port 8071 -InformationLevel Quiet
$ProgressPreference = "Continue"
$WarningPreference = "Continue"
if ($result) {
return
}

Write-Run "Write-Error `"prerequisites.ps1 (2): localhost cannot connect to Logz.io logs. please check your network for port 8071`""
return 2
}

# Checks if localhost can connect to Logz.io metrics (port 8053)
# Error:
# Exit Code 2
function Test-CanLocalhostConnectToLogzioMetrics {
. $using:logzioTempDir\utils_functions.ps1
$local:logFile = $using:logFile
$local:runFile = $using:runFile

Write-Log "INFO" "Checking if localhost can connect to Logz.io metrics (port 8053) ..."

$ProgressPreference = "SilentlyContinue"
$WarningPreference = "SilentlyContinue"
$local:result = Test-NetConnection -ComputerName listener.logz.io -Port 8053 -InformationLevel Quiet
$ProgressPreference = "Continue"
$WarningPreference = "Continue"
if ($result) {
return
}

Write-Run "Write-Error `"prerequisites.ps1 (2): localhost cannot connect to Logz.io logs. please check your network for port 8053`""
return 2
}
19 changes: 19 additions & 0 deletions Localhost/Windows/System/prerequisites/windows/prerequisites.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#################################################################################################################################
################################################# Prerequisites Windows Script ##################################################
#################################################################################################################################

# Load functions
Write-Log "INFO" "Loading prerequisites functions ..."
. $logzioTempDir\prerequisites_functions.ps1

# Install yq
Invoke-Task "Install-YQ" "installing yq"

# Check if localhost can connect to Logz.io logs (port 8071)
Invoke-Task "Test-CanLocalhostConnectToLogzioLogs" "checking if localhost can connect to Logz.io logs"

# Check if localhost can connect to Logz.io metrics (port 8053)
Invoke-Task "Test-CanLocalhostConnectToLogzioMetrics" "checking if localhost can connect to Logz.io metrics"

# Finished successfully
Exit 0
21 changes: 21 additions & 0 deletions Localhost/Windows/System/telemetry/installer/otel_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
receivers:
processors:
resourcedetection/system:
detectors: ["system"]
system:
hostname_sources: ["os"]
exporters:
logging:
service:
pipelines:
logs:
receivers: []
processors: [resourcedetection/system]
exporters: []
metrics:
receivers: []
processors: [resourcedetection/system]
exporters: []
telemetry:
logs:
level: "debug"
Loading

0 comments on commit 7a3f0bd

Please sign in to comment.