The advanced logging app for Cisco WSA redefines monitoring and troubleshooting by aggregating diverse logs from Cisco WSA devices. A standout feature is its unparalleled ability to parse and visualize the typically concealed prox_track log, unconfigurable through the GUI. Positioned as both a replacement for and a valuable addition to traditional SNMP-based monitoring, this app excels across various crucial areas:
cisco:wsa:systemlogs
.cisco_wsa_shd_index_and_sourcetype
, cisco_wsa_prox_track_index_and_sourcetype
, cisco_wsa_system_logs_index_and_sourcetype
.Instead of continious retrieval, you can just upload logs on demand:
Log | Source | Sourcetype | Retrieval Method | Comment/Example |
---|---|---|---|---|
track_stats | /track_stats/prox_track.log | cisco:wsa:prox_track | ftp/scp pull + script for cont. monitoring | Multiline (~1300 lines/event)user time: 0.120 (0.040%) system time: 0.179 (0.060%) |
System Health Logs / SHD Logs | shd_logs | cisco:wsa:shd (extracted from cisco:wsa:systemlogs) | syslog/ftp/scp | CPULd 14.1 DskUtil 7.9 RAMUtil 13.2 Reqs 0 Band 0 Latency 0 CacheHit 0 CliConn 0 SrvConn 0 MemBuf 0 SwpPgOut 534462 |
Audit Logs | audit_log | cisco:wsa:systemlogs | syslog/ftp/scp | Interaction Mode: GUI, User: admin, Source IP: l0.1.1.0, Destination IP: l0.2.2.2, Location: /login, Event: Successful Login |
CLI Logs | cli | cisco:wsa:systemlogs | syslog/ftp/scp | User admin login from l0.1.1.2 on l0.2.2.2 User admin entered 'alertconfig' |
GUI Logs | gui | cisco:wsa:systemlogs | syslog/ftp/scp | req:10.1.1.1 user:admin 200 POST /system_administration/access/network_access HTTP/1.1 Mozilla/5.0 |
Default Proxy Logs | proxyerrlog | cisco:wsa:systemlogs | syslog/ftp/scp | Warning: CONFIG Redirect hostname configuration error |
Status Logs | status | cisco:wsa:systemlogs | syslog/ftp/scp | ?? |
System Logs | system | cisco:wsa:systemlogs | syslog/ftp/scp | User admin commit changes |
Authentication Framework Logs | authlog | cisco:wsa:systemlogs | ftp/scp | ?? |
HTTPS Logs | httpslog | cisco:wsa:systemlogs | ftp/scp | ?? client cert ?? |
Http2 proxy Logs | http2log | cisco:wsa:systemlogs | ftp/scp | ?? |
This app should work with Splunk 7/8/9 on Windows and Linux platforms.
It is important that Splunk recognize WSA either by hostname, FQDN or IP address consistently. If you choose FQDN then it should work for both cisco:wsa:prox_track and cisco:wsa:systemlogs.
props.conf:
[cisco:wsa:systemlogs] TRANSFORMS-extract_host_from_syslog_header = extract_host_from_syslog_headertransforms.conf:
[extract_host_from_syslog_header] # Jan 31 18:59:48 wsa.example.com shd_syslog: Info: # <14>Jan 31 18:59:48 wsa.example.com shd_syslog: Info: # Jan 31 22:56:24 10.20.30.40 Jan 31 22:56:05 wsa.example.com shd_syslog: Info: REGEX = ^.{0,50}[A-Z][a-z][a-z]\s\s?\d\d?\s\d\d:\d\d:\d\d\s(\S+)\s\S+:\s[A-Z][a-z]+: FORMAT = host::$1 DEST_KEY = MetaData:Host
To improve readability you can add following stanza to the udp input definition in inputs.conf to remove redundant data received via UDP:
# Make sure the prio syslog field is removed: # Whether or not the input strips <priority> syslog fields from events it receives over the syslog input. # A value of "true" means the instance does NOT strip the <priority> syslog field from received events. # This will change "<14>Jan 31 18:59:48 wsa.example.com" to "Jan 31 18:59:48 wsa.example.com" no_priority_stripping = false # Make sure Splunk doesn't add a second timestamp # Whether or not to append a timestamp and host to received events. # A value of "true" means the instance does NOT append a timestamp and host to received events. # Default: false # This will change "14 Jan 31 18:59:48 10.20.30.40 Jan 31 18:59:48 wsa.example.com" to "Jan 31 18:59:48 wsa.example.com" no_appending_timestamp = true
Log pushing is a robust yet non-realtime log transfer method. Certain log types, such as https_logs and authlogs logs, do not support Syslog, therefore, log pushing is the only available method for them.
~/.ssh
and ~/.ssh/authorized_keys
have correct permissions:chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
/wsa_logs/wsa.example.com/
(replace log name as needed. Make sure the folder exists and has right owndership and permissions). For SCP transfer, after you click Submit, you'll get a message to place the following SSH key(s) into your authorized_keys file on the remote (receiver) host. Commit changes.*/10 * * * * find /wsa_logs/wsa.example.com/authlog* -type f -mmin +60 -delete
[monitor:///wsa_logs/*/authlog*] disabled = false host_segment = 2 sourcetype = cisco:wsa:systemlogs
Warning: avoid running this script as root user.
mkdir /wsa_logs
get_prox_track.sh
in this folder (modify USER and DIR variables as needed):
#!/bin/bash USER=getlog WSA_HOST=$1 DIR=/wsa_logs/ # check if the script with same parameters (user+host) is already running pgrep -a ssh | grep $USER | grep $WSA_HOST | grep -q prox_track.log if [ $? -eq 0 ]; then exit fi if [ ! -d $DIR/$WSA_HOST ]; then mkdir $DIR/$WSA_HOST ; fi cd $DIR/$WSA_HOST timestamp=$(date +%s) if [ ! -f timestamp.txt ]; then touch timestamp.txt ; fi scp $USER@$WSA_HOST:/track_stats/prox_track.log $timestamp grep -A1000000 -f timestamp.txt $timestamp | grep -A1000000 -P "^\s+ user time: " | grep -A1000000 -E "^Current Date: " | grep -E -f ../patterns.txt > prox_track.log grep "^Current Date:" $timestamp | tail -1 > timestamp.txt rm -f $timestamp find $DIR/$WSA_HOST -type f -name "1[78][0-9]*" -mtime +1 -delete # clean up old timestamp files
chmod +x get_prox_track.sh
ssh-keygen
commandsshconfig > userkey > user > [username] > new
scp username@wsa:/track_stats/prox_track.log /dev/null
. At the first run you'll get a confirmation prompt, type yes
to confirm./wsa_logs
), place a file patterns.txt
with following content:^Current Date: ^INFO: proxy running for ^INFO: traffic over ^INFO: Transparent NTLMSSP ^INFO: Basic Auth ^INFO: Negotiate Auth ^INFO: AuthCache: Capacity ^INFO: DNS Cache Stats: weightavg user time: system time: block input operations: block output operations: DNS Time Auth Helper Service Time Auth Helper Wait Time WBRS Wait Time WBRS Service Time Server Transaction Time Server Wait Time Client Time page faults: involuntary context switches
/wsa_logs/ ├── get_prox_track.sh └─── patterns.txt
/wsa_logs/get_prox_track.sh wsa2.example.local
against every WSA host (replace the hostname as needed)./wsa_logs/ ├── get_prox_track.sh ├── patterns.txt ├── wsa1.example.local │ ├── prox_track.log │ └── timestamp.txt ├── wsa2.example.local │ ├── prox_track.log │ └── timestamp.txt ├── wsa3.example.local │ ├── prox_track.log │ └── timestamp.txt └── wsa4.example.local ├── prox_track.log └── timestamp.txt
* * * * * /wsa_logs/get_prox_track.sh wsa1.example.local &>/dev/null * * * * * /wsa_logs/get_prox_track.sh wsa2.example.local &>/dev/null
[monitor:///wsa_logs/*/prox_track.log] disabled = false host_segment = 2 sourcetype = cisco:wsa:prox_track
WARNING: Running on Windows not fully supported yet, use on your own risk.
To run a script to get prox_track logs on Windows (including Windows Service Core) follow these steps:
setup-x86_64.exe --no-admin -D -d -n -N -X -v -l c:\cygwin
bash.exe cygiconv-2.dll cygintl-8.dll cygncursesw-10.dll cygpcre-1.dll cygreadline7.dll cygstdc++-6.dll cygwin1.dll date.exe grep.exe mkdir.exe rm.exe tail.exe touch.exeAlternatively, you can just install cygwin.
#!/bin/bash WSA_HOST=$1 DIR=c:/wsa_logs/ PATH=.:.. if [ ! -d $DIR/$WSA_HOST ]; then mkdir $DIR/$WSA_HOST ; fi cd $DIR/$WSA_HOST timestamp=$(date +%s) if [ ! -f timestamp.txt ]; then touch timestamp.txt ; fi pscp -P 22 -i ../priv.ppk getlog@$WSA_HOST:/track_stats/prox_track.log $timestamp ../grep -A1000000 -f timestamp.txt $timestamp | ../grep -A1000000 -P "^\s+ user time: " | ../grep -A1000000 -E "^Current Date: " | ../grep -E -f ../patterns.txt > prox_track.log ../grep "^Current Date:" $timestamp | ../tail -1 > timestamp.txt rm -f $timestamp
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <RegistrationInfo> <Date>2022-05-18T16:35:41</Date> <Author>PavelP</Author> <URI>get WSANAME prox_track.log</URI> </RegistrationInfo> <Principals> <Principal id="Author"> <UserId>S-1-5-18</UserId> </Principal> </Principals> <Settings> <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <IdleSettings> <Duration>PT10M</Duration> <WaitTimeout>PT1H</WaitTimeout> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> </Settings> <Triggers> <TimeTrigger> <StartBoundary>2022-05-18T16:35:00</StartBoundary> <Repetition> <Interval>PT2M</Interval> </Repetition> </TimeTrigger> </Triggers> <Actions Context="Author"> <Exec> <Command>c:\wsa_logs\bash.exe</Command> <Arguments>c:\wsa_logs\getlog.sh WSANAME > c:\wsa_logs\WSANAME.log</Arguments> <WorkingDirectory>c:\wsa_logs\</WorkingDirectory> </Exec> </Actions> </Task>]]>
PsExec64.exe -u "nt authority\system" -i -s cmd
C:\wsa_logs>c:\wsa_logs\bash.exe c:\wsa_logs\getlog.sh WSANAME The server's host key is not cached in the registry. If you trust this host, enter "y" to add the key to PuTTY's cache and carry on connecting. Store key in cache? (y/n)The previous two steps can be skipped by copying
HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys to HKEY_USERS\S-1-5-18
C:\wsa_logs>schtasks /create /tn WSANAME /xml scheduler.xml SUCCESS: The scheduled task "WSANAME" has successfully been created.
C:\wsa_logs>schtasks /query /tn WSANAME /v /fo list
C:\wsa_logs │ bash.exe │ cygiconv-2.dll │ cygintl-8.dll │ cygncursesw-10.dll │ cygpcre-1.dll │ cygreadline7.dll │ cygstdc++-6.dll │ cygwin1.dll │ date.exe │ getlog.sh │ grep.exe │ mkdir.exe │ patterns.txt │ priv.ppk │ pscp.exe │ PsExec64.exe │ rm.exe │ schedule.xml │ tail.exe │ touch.exe │ ├───wsa1.example.local │ prox_track.log │ timestamp.txt │ └───wsa2.example.local prox_track.log timestamp.txt
Contact: splunk@compek.net
added Audit-Timeline view, support for audit, cli, gui, proxyerr, system and status logs.
added options to adjust visualization modes (switch area/line, disable stacked mode, linear/logarithmic)
moved Swap statistics in a separate panel (SHD* > Swap) for better visibility. Added sc_admin in default.meta
applied required changes to keep compatibility with Splunk Cloud (use jquery 3.5)
As a Splunkbase app developer, you will have access to all Splunk development resources and receive a 10GB license to build an app that will help solve use cases for customers all over the world. Splunkbase has 1000+ apps from Splunk, our partners and our community. Find an app for most any data source and user need, or simply create your own with help from our developer portal.