Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladimirnani/d281c15ddf773adb80727eef5be34ab6 to your computer and use it in GitHub Desktop.
Save vladimirnani/d281c15ddf773adb80727eef5be34ab6 to your computer and use it in GitHub Desktop.
evision_adds_logstash
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n=allowGlobalConfirmation
choco install logstash --version 6.2.4
choco feature disable -n=allowGlobalConfirmation
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
$config = @"
input {
file {
path => "C:/CustomLogs/*.log"
start_position => "beginning"
codec => multiline {
pattern => "^%{TIMESTAMP_ISO8601} "
negate => true
what => "previous"
}
}
}
filter {
grok {
match => ["message", "%{TIMESTAMP_ISO8601:tstamp} \[%{WORD:threadId}\] %{WORD:level} %{NOTSPACE:classname} \[%{NOTSPACE:context}?\] (\-)? %{DATA:msg}"]
}
date {
match => ["tstamp", "ISO8601"]
}
}
output {
elasticsearch {
hosts => ["vpc-pv8logging-qeckbwdfcejy2eui4t2bt2euza.eu-west-1.es.amazonaws.com:80"]
index => "evision"
}
stdout { }
}
"@
$logstashPath = 'C:\ProgramData\chocolatey\lib\logstash\tools\logstash-6.2.4\bin\'
$configPath = $logstashPath + '\config.json'
$exePath = $logstashPath + '\logstash.bat'
Out-File -FilePath $configPath -InputObject $config -Encoding ASCII
iex "$exePath -f $configPath"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment