pfSense syslog to Azure Sentinel Guide

%3CLINGO-SUB%20id%3D%22lingo-sub-2004352%22%20slang%3D%22en-US%22%3EpfSense%20syslog%20to%20Azure%20Sentinel%20Guide%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2004352%22%20slang%3D%22en-US%22%3E%3CP%3EI've%20seen%20various%20posts%20across%20the%20internet%20of%20people%20trying%20to%20get%20pfSense%20working%20with%20Azure%20Sentinel%20and%20I%20wanted%20to%20share%20this%20project%20I%20have%20been%20working%20on%20myself.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20firstly%20like%20to%20say%20thank%20you%20to%20some%20of%20the%20great%20open-source%20projects%20out%20there%20on%20GitHub%20which%20made%20this%20entire%20process%20possible.%20I%20would%20like%20to%20call%20out%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fpfelk%2Fpfelk%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ea3ilson%3C%2FA%3E%20for%20his%20awesome%20work%20with%20PFELK%2C%20I%20have%20used%20his%20GROK%20patterns%20which%20parse%20the%20pfSense%20data%20and%20add%20additional%20context%20the%20messages%2C%20such%20as%20GeoIP%20data%2C%20rule%20types%2C%20friendly%20names%20and%20more.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFurther%20information%20about%20this%20project%20and%20some%20KQL%20functions%20can%20be%20found%20on%20my%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EGitHub%3C%2FA%3E%20page%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image1.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F241918iFB5066BD12DD0561%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image1.png%22%20alt%3D%22image1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CU%3E%3CFONT%20size%3D%226%22%3EConfiguration%3C%2FFONT%3E%3C%2FU%3E%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%225%22%3EUbuntu%2020.04%20Server%20onPrem%3C%2FFONT%3E%3CBR%20%2F%3E%3CBR%20%2F%3E1.%20Install%20Ubuntu%2020.04%20on%20a%20Virtual%20Machine%20or%20Computer%20and%20update%20the%20OS%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20apt%20update%3B%20sudo%20apt%20upgrade%20-y%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E2.%20Disabling%20Swap%20-%20Swapping%20can%20be%20disabled%20for%20performance%20and%20stability.%20(Optional)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20swapoff%20-a%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E3.%20Configuration%20Date%2FTime%20Zone%3C%2FP%3E%3CUL%3E%3CLI%3EThe%20box%20running%20this%20configuration%20will%20reports%20firewall%20logs%20based%20on%20its%20clock.%20The%20command%20below%20will%20set%20the%20timezone%20to%20Eastern%20Standard%20Time%20(EST).%3CBR%20%2F%3ETo%20view%20available%20timezones%20type%20%22%3CEM%3Esudo%20timedatectl%20list-timezones%22%3C%2FEM%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3Esudo%20timedatectl%20set-timezone%20Europe%2FLondon%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E4.%20Download%20and%20install%20the%20public%20GPG%20signing%20key%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Ewget%20-qO%20-%20https%3A%2F%2Fartifacts.elastic.co%2FGPG-KEY-elasticsearch%20%7C%20sudo%20apt-key%20add%20-%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E5.%20Download%20and%20install%20apt-transport-https%20package%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20apt%20install%20apt-transport-https%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E6.%20Add%20Elasticsearch%7CLogstash%20Repositories%20(version%207%2B)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eecho%20%22deb%20https%3A%2F%2Fartifacts.elastic.co%2Fpackages%2F7.x%2Fapt%20stable%20main%22%20%7C%20sudo%20tee%20-a%20%2Fetc%2Fapt%2Fsources.list.d%2Felastic-7.x.list%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E7.%20Install%20Java%2014%20LTS%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20apt%20install%20openjdk-14-jre-headless%E2%80%8B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CFONT%20size%3D%225%22%3EInstall%20and%20Configure%20MaxMind%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Add%20MaxMind%20Repository%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20add-apt-repository%20ppa%3Amaxmind%2Fppa%E2%80%8B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E2.%20Install%20MaxMind%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20apt%20install%20geoipupdate%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E3.%20Configure%20MaxMind%3C%2FP%3E%3CP%3ECreate%20a%20%3CA%20href%3D%22https%3A%2F%2Fwww.maxmind.com%2Fen%2Fgeolite2%2Fsignup%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EMaxMind%20Account%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3ELogin%20to%20your%20MaxMind%20Account%3B%20navigate%20to%20%22My%20License%20Key%22%20under%20%22Services%22%20and%20Generate%20a%20new%20license%20key%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E4.%20Add%20the%20new%20license%20keys%20to%20the%20configuration%20file%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20nano%20%2Fetc%2FGeoIP.conf%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E5.%20Modify%20lines%207%20%26amp%3B%208%20as%20follows%20(without%20%26lt%3B%20%26gt%3B)%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3EAccountID%20%3CINPUT%20your%3D%22%22%20account%3D%22%22%20id%3D%22%22%20%2F%3E%0ALicenseKey%20%3CINPUT%20your%3D%22%22%20licensekey%3D%22%22%20%2F%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E6.%20Modify%20line%2013%20as%20follows%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EEditionIDs%20GeoLite2-City%20GeoLite2-Country%20GeoLite2-ASN%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E7.%20Modify%20line%2018%20as%20follows%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3EDatabaseDirectory%20%2Fusr%2Fshare%2FGeoIP%2F%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E8.%20Download%20Maxmind%20Databases%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20geoipupdate%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E9.%20Add%20cron%20(automatically%20updates%20Maxmind%20everyweek%20on%20Sunday%20at%201700hrs)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20nano%20%2Fetc%2Fcron.weekly%2Fgeoipupdate%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E10.%20Add%20the%20following%20and%20save%2Fexit%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3E00%2017%20*%20*%200%20geoipupdate%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%225%22%3ELogstash%20Configuration%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Install%20Logstash%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20apt%20update%20%26amp%3B%26amp%3B%20sudo%20apt%20install%20logstash%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E2.%20Create%20Required%20Directories%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3Esudo%20mkdir%20%2Fetc%2Flogstash%2Fconf.d%2F%7Bdatabases%2Cpatterns%2Ctemplates%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E3.%20Download%20the%20following%20configuration%20files%20(Required)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3Esudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F01-inputs.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%0Asudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F02-types.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%0Asudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F03-filter.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%0Asudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F05-firewall.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%0Asudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F07-interfaces.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%0Asudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F10-apps.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%0Asudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F30-geoip.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%0Asudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F45-cleanup.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%0Asudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F50-outputs.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E4.%20Download%20the%20following%20configuration%20files%20(Optional)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3Esudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F35-rules-desc.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%0Asudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2F36-ports-desc.conf%20-P%20%2Fetc%2Flogstash%2Fconf.d%2F%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E5.%20Download%20the%20grok%20pattern%20(Required)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2Fpatterns%2Fpfelk.grok%20-P%20%2Fetc%2Flogstash%2Fconf.d%2Fpatterns%2F%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E6.%20Download%20the%20Database(s)%20(Optional)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2Fdatabases%2Frule-names.csv%20-P%20%2Fetc%2Flogstash%2Fconf.d%2Fdatabases%2F%0Asudo%20wget%20https%3A%2F%2Fraw.githubusercontent.com%2Fnoodlemctwoodle%2Fpfsense-azure-sentinel%2Fmain%2FLogstash-Configuration%2Fetc%2Flogstash%2Fconf.d%2Fdatabases%2Fservice-names-port-numbers.csv%20-P%20%2Fetc%2Flogstash%2Fconf.d%2Fdatabases%2F%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E7.%20Configure%20Firewall%20Rule%20Database%20(Optional)%3C%2FP%3E%3COL%20class%3D%22lia-list-style-type-lower-alpha%22%3E%3CLI%3EGo%20to%20your%20pfSense%20GUI%20and%20go%20to%20Firewall%20-%26gt%3B%20Rules.%3C%2FLI%3E%3CLI%3EEnsure%20the%20rules%20have%20a%20description%2C%20this%20is%20the%20text%20you%20will%20see%20in%20Azure%20Sentinel.%3C%2FLI%3E%3CLI%3EBlock%20rules%20normally%20have%20logging%20on%2C%20if%20you%20want%20to%20see%20good%20traffic%20also%2C%20enable%20logging%20for%20pass%20rules.%3C%2FLI%3E%3CLI%3EExtract%20rule%20descriptions%20with%20associated%20tracking%20number%3C%2FLI%3E%3C%2FOL%3E%3CP%3EIn%20pfSense%20and%20go%20to%20diagnostics%20-%26gt%3B%20Command%20Prompt%3C%2FP%3E%3CP%3EEnter%20the%20following%20command%20in%20the%20execute%20shell%20command%20box%20and%20click%20the%20execute%20button%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Epfctl%20-vv%20-sr%20%7C%20grep%20USER_RULE%20%7C%20sed%20's%2F%40%5C(%5B%5E(%5D*%5C).*%22USER_RULE%3A%20*%5C(%5B%5E%22%5D*%5C).*%2F%22%5C1%22%2C%22%5C2%22%2F'%20%7C%20sort%20-t%20'%20'%20-k%201%2C1%20-u%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20results%20will%20look%20something%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3E%2255%22%2C%22NAT%20Redirect%20DNS%22%0A%2256%22%2C%22NAT%20Redirect%20DNS%22%0A%2257%22%2C%22NAT%20Redirect%20DNS%20TLS%22%0A%2258%22%2C%22NAT%20Redirect%20DNS%20TLS%22%0A%2260%22%2C%22BypassVPN%22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECopy%20the%20entire%20results%20to%20your%20clipboard%20and%20past%20within%20the%20rule-names.csv%20as%20follows%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%22Rule%22%2C%22Label%22%0A%2255%22%2C%22NAT%20Redirect%20DNS%22%0A%2256%22%2C%22NAT%20Redirect%20DNS%22%0A%2257%22%2C%22NAT%20Redirect%20DNS%20TLS%22%0A%2258%22%2C%22NAT%20Redirect%20DNS%20TLS%22%0A%2260%22%2C%22BypassVPN%22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E8.%20Update%20the%20Logstash%20configuration%3CBR%20%2F%3EGo%20back%20to%20the%20server%20you%20installed%20Logstash.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20nano%20%2Fetc%2Flogstash%2Fconf.d%2Fdatabases%2Frule-names.csv%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E9.%20Paste%20the%20the%20results%20from%20pfSense%20into%20the%20first%20blank%20line%20after%20%220%22%2C%22null%22%3CBR%20%2F%3E%3CSTRONG%3EExample%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3E%220%22%2C%22null%22%0A%221%22%2C%22Input%20Firewall%20Description%20Here%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EYou%20must%20repeat%20step%201%20(Rules)%20if%20you%20add%20new%20rules%20in%20pfSense%20and%20then%20restart%20Logstash%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E10.%20Update%20firewall%20interfaces%3C%2FP%3E%3CP%3EAmend%20the%2005-firewall.conf%20file%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3Esudo%20nano%20%2Fetc%2Flogstash%2Fconf.d%2F05-firewall.conf%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAdjust%20the%20interface%20name(s)%20to%20correspond%20with%20your%20hardware%20the%20interface%20below%20is%20referenced%20as%20igb0%20with%20a%20corresponding%20%E2%80%9CWAN%E2%80%9D%20and%20friendly%20name%20of%20%22ISP%20Provider%22.%20Add%2Fremove%20sections%2C%20depending%20on%20the%20number%20of%20interfaces.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%23%23%23%20Change%20interface%20as%20desired%20%23%23%23%0Aif%20%5Binterface%5D%5Bname%5D%20%3D~%20%2F%5Eigb0%24%2F%20%7B%0Amutate%20%7B%0A%20%20%20%20%20%20%20%20add_field%20%3D%26gt%3B%20%7B%20%22%5Binterface%5D%5Balias%5D%22%20%3D%26gt%3B%20%22WAN%22%20%7D%0A%20%20%20%20%20%20%20%20add_field%20%3D%26gt%3B%20%7B%20%22%5Bnetwork%5D%5Bname%5D%22%20%3D%26gt%3B%20%22ISP%20Provider%22%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%225%22%3EForwarding%20pfSense%20Logs%20to%20Logstash%3C%2FFONT%3E%3C%2FP%3E%3CP%3E1.%20In%20pfSense%20navigate%20to%20Status%20-%26gt%3B%20System%20Logs%20-%26gt%3B%20Settings%3C%2FP%3E%3CP%3E2.%20General%20Logging%20Options%3C%2FP%3E%3CUL%3E%3CLI%3EShow%20log%20entries%20in%20reverse%20order%20(newest%20entries%20on%20top)%3C%2FLI%3E%3C%2FUL%3E%3CP%3E3.%20General%20Logging%20Options%20%26gt%3B%20Log%20firewall%20default%20blocks%20(optional)%3C%2FP%3E%3CUL%3E%3CLI%3ELog%20packets%20matched%20from%20the%20default%20block%20rules%20in%20the%20ruleset%3C%2FLI%3E%3CLI%3ELog%20packets%20matched%20from%20the%20default%20pass%20rules%20put%20in%20the%20ruleset%3C%2FLI%3E%3CLI%3ELog%20packets%20blocked%20by%20'Block%20Bogon%20Networks'%20rules%3C%2FLI%3E%3CLI%3ELog%20packets%20blocked%20by%20'Block%20Private%20Networks'%20rules%3C%2FLI%3E%3CLI%3ELog%20errors%20from%20the%20webserver%20process%3C%2FLI%3E%3C%2FUL%3E%3CP%3E4.%20Remote%20Logging%20Options%3A%3C%2FP%3E%3CUL%3E%3CLI%3Echeck%20%22Send%20log%20messages%20to%20remote%20syslog%20server%22%3C%2FLI%3E%3CLI%3ESelect%20a%20specific%20interface%20to%20use%20for%20forwarding%20(optional)%3C%2FLI%3E%3CLI%3ESelect%20IPv4%20for%20IP%20Protocol%3C%2FLI%3E%3CLI%3EEnter%20the%20Logstash%20server%20local%20IP%20into%20the%20field%20Remote%20log%20servers%20with%20port%205140%20(eg%20192.168.1.50%3A5140)%3C%2FLI%3E%3CLI%3EUnder%20%22Remote%20Syslog%20Contents%22%20check%20%22Everything%22%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image3.png%22%20style%3D%22width%3A%20850px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F241946i8FEEC76E6D18D985%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image3.png%22%20alt%3D%22image3.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CFONT%20size%3D%225%22%3EInstall%20Log%20Analytics%20Plugin%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E1.%20Run%20the%20command%20to%20install%20the%20Azure%20Log%20Analytics%20plugin%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20%2Fusr%2Fshare%2Flogstash%2Fbin%2Flogstash-plugin%20install%20logstash-output-azure_loganalytics%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E2.%20Configuration%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eoutput%20%7B%0A%20%20%20%20%20%20%20%20azure_loganalytics%20%7B%0A%20%20%20%20%20%20%20%20customer_id%20%3D%26gt%3B%20%22%3COMS%20workspace%3D%22%22%20id%3D%22%22%3E%22%0A%20%20%20%20%20%20%20%20shared_key%20%3D%26gt%3B%20%22%3CCLIENT%20auth%3D%22%22%20key%3D%22%22%3E%22%0A%20%20%20%20%20%20%20%20log_type%20%3D%26gt%3B%20%22%3CLOG%20type%3D%22%22%20name%3D%22%22%3E%22%0A%20%20%20%20%20%20%20%20%7D%0A%7D%3C%2FLOG%3E%3C%2FCLIENT%3E%3C%2FOMS%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EExample%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Eoutput%20%7B%0A%20%20%20%20%20%20%20%20azure_loganalytics%20%7B%0A%20%20%20%20%20%20%20%20customer_id%20%3D%26gt%3B%20%221234567-7654321-345678-12334445%22%0A%20%20%20%20%20%20%20%20shared_key%20%3D%26gt%3B%20%22kflsdjkgfslfjsdf0ife0f0efe0-09f0we9f-ef-w00e-0w-f0w-0fwe-f0d0-w%3D%3D%22%0A%20%20%20%20%20%20%20%20log_type%20%3D%26gt%3B%20%22pfsense_logstash%22%0A%20%20%20%20%20%20%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E3.%20Restart%20Logstash%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20systemctl%20restart%20logstash%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E4.%20If%20you%20run%20into%20any%20problems%20use%20the%20Logstash%20plain.log%20to%20troubleshoot%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Ecat%20%2Fvar%2Flog%2Flogstash%2Flogstash-plain.log%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E5.%20Wait%20for%20data%20to%20show%20in%20Azure%20Sentinel%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image2.png%22%20style%3D%22width%3A%20480px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F241919iB87DA71845694A66%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22image2.png%22%20alt%3D%22image2.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CFONT%20size%3D%225%22%3EQuery%20the%20data%3C%2FFONT%3E%3C%2FP%3E%3CP%3E1.%20Using%20KQL%20we%20can%20now%20query%20the%20data%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E%2F%2F%20PFSesne%20GeoIp%20Traffic%0Apfsense_logstash_CL%0A%7C%20where%20TimeGenerated%20%26gt%3B%20ago(1m)%0A%7C%20where%20tags_s%20contains%20%22GeoIP_Destination%22%0A%7C%20extend%20event_created_t%20%3D%20TimeGenerated%0A%7C%20extend%20ruleName%20%3D%20iif(rule_uuid_s%20%3D%3D%20'1572780236'%2C%20'Rule%20ID%20Name'%2C%0Aiif(rule_uuid_s%20%3D%3D%20'1572814498'%2C%20'Rule%20ID%20Name'%2C%0Aiif(rule_uuid_s%20%3D%3D%20'1572814518'%2C%20'Rule%20ID%20Name'%2C%0Aiif(rule_uuid_s%20%3D%3D%20'1572820907'%2C%20'Rule%20ID%20Name'%2C%0Aiif(rule_uuid_s%20%3D%3D%20'1572822148'%2C%20'Rule%20ID%20Name'%2C%0Aiif(rule_uuid_s%20%3D%3D%20'1572822176'%2C%20'Rule%20ID%20Name'%2C%0Aiff(rule_uuid_s%20%3D%3D%20'1572822195'%2C%20'Rule%20ID%20Name'%2C%0Aiff(rule_uuid_s%20%3D%3D%20'1575628181'%2C%20'Rule%20ID%20Name'%2C%0A''))))))))%0A%7C%20project%20TimeGenerated%2C%20interface_alias_s%2C%20network_name_s%2C%20interface_name_s%2C%20source_ip_s%2C%20source_port_s%2C%20source_geo_region_name_s%2C%20source_geo_country_iso_code_s%2C%0Asource_geo_country_name_s%2C%20destination_ip_s%2C%20destination_port_s%2C%20destination_geo_region_name_s%2C%20destination_geo_country_code3_s%2C%0Anetwork_direction_s%2C%20event_action_s%2C%20event_reason_s%2C%20ruleName%2C%20destination_service_s%2C%20network_transport_s%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

I've seen various posts across the internet of people trying to get pfSense working with Azure Sentinel and I wanted to share this project I have been working on myself.

 

I would firstly like to say thank you to some of the great open-source projects out there on GitHub which made this entire process possible. I would like to call out a3ilson for his awesome work with PFELK, I have used his GROK patterns which parse the pfSense data and add additional context the messages, such as GeoIP data, rule types, friendly names and more.

 

Further information about this project and some KQL functions can be found on my GitHub page

 

image1.png


Configuration

Ubuntu 18.04-20.04 Server onPrem
1. Install Ubuntu Server 20.04 on a Virtual Machine or Computer and update the OS

 

 

sudo apt update; sudo apt upgrade -y

 

 

2. Disabling Swap - Swapping can be disabled for performance and stability. (Optional)

 

 

sudo swapoff -a

 

 

3. Configuration Date/Time Zone

  • The box running this configuration will reports firewall logs based on its clock. The command below will set the timezone to Eastern Standard Time (EST).
    To view available timezones type "sudo timedatectl list-timezones"

 

 

sudo timedatectl set-timezone Europe/London

 

 

4. Download and install the public GPG signing key

 

 

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

 

 

5. Download and install apt-transport-https package

 

 

sudo apt install apt-transport-https

 

 

6. Add Elasticsearch|Logstash Repositories (version 7+)

 

 

echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list

 

 

7. Install Java 14 LTS

 

 

sudo apt install openjdk-14-jre-headless​

 

 

 

Install and Configure MaxMind (Optional)

1. Add MaxMind Repository 

This step is optional, you can skip this step and the configuration will default to the built-in GeoIP lookups for Elastic 

 

 

sudo add-apt-repository ppa:maxmind/ppa​

 

 

2. Install MaxMind

 

 

sudo apt install geoipupdate

 

 

3. Configure MaxMind

Create a MaxMind Account

  • Login to your MaxMind Account; navigate to "My License Key" under "Services" and Generate a new license key

4. Add the new license keys to the configuration file

 

 

sudo nano /etc/GeoIP.conf

 

 

5. Modify lines 7 & 8 as follows (without < >):

 

 

AccountID <Input Your Account ID>
LicenseKey <Input Your LicenseKey>

 

 

6. Modify line 13 as follows:

 

 

EditionIDs GeoLite2-City GeoLite2-Country GeoLite2-ASN

 

 

7. Modify line 18 as follows:

 

 

DatabaseDirectory /usr/share/GeoIP/

 

 

8. Download Maxmind Databases

 

 

sudo geoipupdate

 

 

9. Add cron (automatically updates Maxmind every week on Sunday at 1700hrs)

 

 

sudo nano /etc/cron.weekly/geoipupdate

 

 

10. Add the following and save/exit

 

 

00 17 * * 0 geoipupdate

 

 

 

Logstash Configuration

1. Install Logstash

 

 

sudo apt update && sudo apt install logstash

 

 

2. Create Required Directories

 

 

sudo mkdir /etc/logstash/conf.d/{databases,patterns,templates}

 

 

3. Download the following configuration files (Required)

 

 

sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/01-inputs.conf -P /etc/logstash/conf.d/
sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/02-types.conf -P /etc/logstash/conf.d/
sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/03-filter.conf -P /etc/logstash/conf.d/
sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/05-firewall.conf -P /etc/logstash/conf.d/
sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/07-interfaces.conf -P /etc/logstash/conf.d/
sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/10-apps.conf -P /etc/logstash/conf.d/
sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/30-geoip.conf -P /etc/logstash/conf.d/
sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/45-cleanup.conf -P /etc/logstash/conf.d/
sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/50-outputs.conf -P /etc/logstash/conf.d/

 

 

4. Download the following configuration files (Optional)

 

 

 sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/pfSense/35-rules-desc.conf -P /etc/logstash/conf.d/

sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/36-ports-desc.conf -P /etc/logstash/conf.d/

 

 

5. Download the grok pattern (Required)

 

 

sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/patterns/pfelk.grok -P /etc/logstash/conf.d/patterns/

 

 

6. Download the Database(s) (Optional) 

 

 

sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/databases/rule-names.csv -P /etc/logstash/conf.d/databases/
sudo wget https://raw.githubusercontent.com/noodlemctwoodle/pfsense-azure-sentinel/main/Logstash-Configuration/etc/logstash/conf.d/databases/service-names-port-numbers.csv -P /etc/logstash/conf.d/databases/

 

 

These databases will be required if you carried out the optional step (4)

 

7. Configure Firewall Rule Database (Optional)

  1. Go to your pfSense GUI and go to Firewall -> Rules.
  2. Ensure the rules have a description, this is the text you will see in Azure Sentinel.
  3. Block rules normally have logging on, if you want to see good traffic also, enable logging for pass rules.
  4. Extract rule descriptions with associated tracking number

In pfSense and go to diagnostics -> Command Prompt

Enter the following command in the execute shell command box and click the execute button

 

 

 pfctl -vv -sr | grep label | sed -r 's/@([[:digit:]]+).*(label "|label "USER_RULE: )(.*)".*/"\1","\3"/g' | sort -V -u | awk 'NR==1{$0="\"Rule\",\"Label\""RS$0}7'

 

 

The results will look something like this:

 

 

"55","NAT Redirect DNS"
"56","NAT Redirect DNS"
"57","NAT Redirect DNS TLS"
"58","NAT Redirect DNS TLS"
"60","BypassVPN"

 

 

Copy the entire results to your clipboard and past within the rule-names.csv as follows:

 

 

"Rule","Label"
"55","NAT Redirect DNS"
"56","NAT Redirect DNS"
"57","NAT Redirect DNS TLS"
"58","NAT Redirect DNS TLS"
"60","BypassVPN"

 

 

8. Update the Logstash configuration
Go back to the server you installed Logstash.

 

 

sudo nano /etc/logstash/conf.d/databases/rule-names.csv

 

 

9. Paste the results from pfSense into the first blank line after "0","null"
Example:

 

 

"0","null"
"1","Input Firewall Description Here

 

 

You must repeat step 1 (Rules) if you add new rules in pfSense and then restart Logstash

10. Update firewall interfaces

Amend the 05-firewall.conf file

 

 

sudo nano /etc/logstash/conf.d/05-firewall.conf

 

 

Adjust the interface name(s) to correspond with your hardware the interface below is referenced as igb0 with a corresponding “WAN” and friendly name of "ISP Provider". Add/remove sections, depending on the number of interfaces.

 

 

### Change interface as desired ###
if [interface][name] =~ /^igb0$/ {
mutate {
        add_field => { "[interface][alias]" => "WAN" }
        add_field => { "[network][name]" => "ISP Provider" }
        }
}

 

 

 

Forwarding pfSense Logs to Logstash

1. In pfSense navigate to Status -> System Logs -> Settings

2. General Logging Options

  • Show log entries in reverse order (newest entries on top)

3. General Logging Options > Log firewall default blocks (optional)

  • Log packets matched from the default block rules in the ruleset
  • Log packets matched from the default pass rules put in the ruleset
  • Log packets blocked by 'Block Bogon Networks' rules
  • Log packets blocked by 'Block Private Networks' rules
  • Log errors from the webserver process

4. Remote Logging Options:

  • check "Send log messages to remote syslog server"
  • Select a specific interface to use for forwarding (optional)
  • Select IPv4 for IP Protocol
  • Enter the Logstash server local IP into the field Remote log servers with port 5140 (eg 192.168.1.50:5140)
  • Under "Remote Syslog Contents" check "Everything"

image3.png

 

Install Log Analytics Plugin

1. Run the command to install the Azure Log Analytics plugin

 

 

sudo /usr/share/logstash/bin/logstash-plugin install logstash-output-azure_loganalytics

 

 

2. Configuration

 

sudo nano /etc/logstash/conf.d/50-outputs.conf

 

Amend the output to match your Sentinel workspace

 

 

output {
        azure_loganalytics {
        customer_id => "<OMS WORKSPACE ID>"
        shared_key => "<CLIENT AUTH KEY>"
        log_type => "<LOG TYPE NAME>"
        }
}

 

 

Example:

 

 

output {
        azure_loganalytics {
        customer_id => "1234567-7654321-345678-12334445"
        shared_key => "kflsdjkgfslfjsdf0ife0f0efe0-09f0we9f-ef-w00e-0w-f0w-0fwe-f0d0-w=="
        log_type => "pfsense_logstash"
        }
}

 

 

3. Restart Logstash

 

 

sudo systemctl restart logstash

 

 

4. If you run into any problems use the Logstash plain.log to troubleshoot

 

 

cat /var/log/logstash/logstash-plain.log

 

 

5. Wait for data to show in Azure Sentinel

image2.png

 

Query the data

1. Using KQL we can now query the data

 

 

// PFSesne GeoIp Traffic
pfsense_logstash_CL
| where TimeGenerated > ago(1m)
| where tags_s contains "GeoIP"
| project TimeGenerated, interface_alias_s, network_name_s, interface_name_s, source_ip_s, source_port_s, source_geo_region_name_s, source_geo_country_iso_code_s,
source_geo_country_name_s, destination_ip_s, destination_port_s, destination_geo_region_name_s, destination_geo_country_code3_s,
network_direction_s, event_action_s, event_reason_s, ruleName, destination_service_s, network_transport_s

 

 

 

 

3 Replies

@TS-noodlemctwoodle the links in section 3. Download the following configuration files (Required)

are not longer working. 

@George__Wilburn There is an updated guide on my github :) 

Eeeeeep careful sending logs plain TCP no TLS.

I know you are doing to on-prem logstash but even so, it would be nice to have a TLS solution ;)