顯示具有 Splunk 標籤的文章。 顯示所有文章
顯示具有 Splunk 標籤的文章。 顯示所有文章

2025年6月27日 星期五

FortiGate firewall configures the Syslog filter

FortiGate firewall configures the Syslog filter

Reference URL :  

https://community.fortinet.com/t5/FortiGate/Technical-Tip-Using-syslog-free-style-filters/ta-p/204606


Test







Log Example:

ssh login

Jun 28 14:06:00 192.168.100.254 date=2025-06-28 time=14:06:00 devname="Test-FW" devid="FGVMEXXXXXXXXXXX" eventtime=1751090760672765479 tz="+0800" logid="0100032001" type="event" subtype="system" level="information" vd="root" logdesc="Admin login successful" sn="1751090760" user="admin" ui="ssh(192.168.100.112)" method="ssh" srcip=192.168.100.112 dstip=192.168.100.254 action="login" status="success" reason="none" profile="super_admin" msg="Administrator admin logged in successfully from ssh(192.168.100.112)"


web login 


Jun 28 14:07:10 192.168.100.254 date=2025-06-28 time=14:07:09 devname="Test-FW" devid="FGVMEXXXXXXXXXXX" eventtime=1751090829377377416 tz="+0800" logid="0100032001" type="event" subtype="system" level="information" vd="root" logdesc="Admin login successful" sn="1751090829" user="admin" ui="http(192.168.100.112)" method="http" srcip=192.168.100.112 dstip=192.168.100.254 action="login" status="success" reason="none" profile="super_admin" msg="Administrator admin logged in successfully from http(192.168.100.112)"


=======================================================

ssh config 

Jun 28 13:48:30 192.168.100.254 date=2025-06-28 time=13:48:30 devname="Test-FW01" devid="FGVMEXXXXXXXXXXX" eventtime=1751089710571156282 tz="+0800" logid="0100032102" type="event" subtype="system" level="alert" vd="root" logdesc="Configuration changed" user="admin" ui="ssh(192.168.100.112)" msg="Configuration is changed in the admin session"

web config 

Jun 28 13:58:07 192.168.100.254 date=2025-06-28 time=13:58:07 devname="Test-FW" devid="FGVMEXXXXXXXXXXX" eventtime=1751090286557611095 tz="+0800" logid="0100032222" type="event" subtype="system" level="notice" vd="root" logdesc="Global setting changed" user="admin" ui="GUI(192.168.100.112)" field="hostname" old_value="Test-FW01" new_value="Test-FW" msg="User admin changed hostname global setting to Test-FW from GUI(192.168.100.112)"


==================================================

FTG Config 

Test-FW # config log syslogd filter

Test-FW (filter) # show
config log syslogd filter
    config free-style
        edit 1
            set category event
            set filter "logid 0100032001 0100032102 0100032222"
        next
        edit 2
            set category traffic
            set filter "srcintf port1"
        next
    end
end

Test-FW (filter) # get
severity            : information
forward-traffic     : enable
local-traffic       : enable
multicast-traffic   : enable
sniffer-traffic     : enable
ztna-traffic        : enable
anomaly             : enable
voip                : enable
gtp                 : enable
free-style:
    == [ 1 ]
    id:     1       category: event
    == [ 2 ]
    id:     2       category: traffic

Test-FW (filter) #

2020年2月13日 星期四

PCAP Analyzer for Splunk

Splunk APP URL

https://splunkbase.splunk.com/app/2748/

GETTING STARTED

https://schwartzdaniel.com/pcap-analyzer-for-splunk-getting-started/



# dnf install wireshark

# tshark --version

# chown splunk.splunk -R /opt/splunk/etc/apps/SplunkForPCAP




[root@centos8 apps]# pwd
/opt/splunk/etc/apps
[root@centos8 apps]# ll
total 0
drwxr-xr-x  7 splunk splunk  79 Feb 14 10:04 alert_logevent
drwxr-xr-x  7 splunk splunk  79 Feb 14 10:04 alert_webhook
drwxr-xr-x  4 splunk splunk  37 Feb 14 10:04 appsbrowser
drwxr-xr-x  6 splunk splunk  68 Feb 14 10:04 gettingstarted
drwxr-xr-x  4 splunk splunk  32 Feb 14 10:04 introspection_generator_addon
drwxr-xr-x  6 splunk splunk  68 Feb 14 10:04 launcher
drwxr-xr-x  5 splunk splunk  50 Feb 14 10:05 learned
drwxr-xr-x  3 splunk splunk  21 Feb 14 10:04 legacy
drwxr-xr-x  6 splunk splunk  66 Feb 14 10:04 sample_app
drwxr-xr-x  9 splunk splunk 109 Feb 14 10:04 search
drwxr-xr-x  6 splunk splunk  64 Feb 14 10:17 splunk_archiver
drwxr-xr-x 11 splunk splunk 179 Feb 14 10:14 SplunkForPCAP
drwxr-xr-x  4 splunk splunk  37 Feb 14 10:04 SplunkForwarder
drwxr-xr-x  7 splunk splunk 130 Feb 14 10:04 splunk_gdi
drwxr-xr-x  3 splunk splunk  21 Feb 14 10:04 splunk_httpinput
drwxr-xr-x  8 splunk splunk  92 Feb 14 10:05 splunk_instrumentation
drwxr-xr-x  4 splunk splunk  37 Feb 14 10:04 SplunkLightForwarder
drwxr-xr-x  8 splunk splunk  96 Feb 14 10:04 splunk_metrics_workspace
drwxr-xr-x 11 splunk splunk 135 Feb 14 10:05 splunk_monitoring_console
drwxr-xr-x  4 splunk splunk  37 Feb 14 10:04 user-prefs
[root@centos8 apps]#


2017年1月8日 星期日

Send Splunk Alerts to Line API 試作

Send Splunk Alerts to Line API 試作,參考 URL 如下



在 Line API 介接的程式放置於  $SPLUNK_HOME/bin/scripts


SPLUNK SNMP DATA WITH CACTI MIRAGE 試作 延伸而來.

其它參考資訊:



[root@bbb scripts]# pwd
/opt/splunk/bin/scripts

[root@bbb scripts]# ll
total 12
-rwxr-xr-x 1 root   root   659 Jan  9 14:30 line.pl
-r--r--r-- 1 splunk splunk  71 Oct 26 00:27 readme.txt

[root@bbb scripts]# cat line.pl 
#!/usr/local/bin/perl
use LINE::Bot::API;
use LINE::Bot::API::Builder::SendMessage;
$bot = LINE::Bot::API->new(
channel_secret => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
channel_access_token => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
);

$ToLineUid = "xxxxxxxxxxxxxxxxxxxxxxx";
$messages = LINE::Bot::API::Builder::SendMessage->new;
$messages->add_text( text => " Splunk $ARGV[0] $ARGV[1] $ARGV[2] $ARGV[3] $ARGV[4] $ARGV[5] $ARGV[6] $ARGV[7] $ARGV[8] " );
$bot->push_message($ToLineUid, $messages->build);

[root@bbb scripts]#

























Demo







































































2016年8月5日 星期五

Server 被掛馬用 Splunk 分析

Server 被掛馬用 Splunk 分析

因為系統漏洞導致 Server 被掛馬.利用的手法為 web-shells
可參考如下 blog
http://securitydisclosures.blogspot.tw/2013/07/web-shells_28.html

操控手法 ".jsp?cmd=" Apache Log 關鍵字

Splunk 的運用實例如下:



















2016年6月8日 星期三

利用 Splunk TA-user-agents App 來分析 Apache log

最近有一個新的需求,想透過  Apache log  來分析出使用者是使用什麼裝置/平台進來.

不小心看到一個 Splunk 很好用,叫 TA-user-agents, URL 如下:


 https://splunkbase.splunk.com/app/1843/#/documentation

 TA-user-agents

 Overview

This TA provides and external Python lookup that parses User Agents strings,
such as those found in Web or Proxy logs.

 Installation

 To install:

 Untar the tarball file in your $SPLUNK_HOME/etc/apps directory.
 Restart Splunk.
 Usage

 The lookup expects a field in the events (http_user_agent). Once that field exists (via extractions, alias or rename). Once that field exists, you can use it in a lookup command, as such:

 index=web_proxy | lookup user_agents http_user_agent


 The lookup will output the following fields:

 ua_os_family: The name of the client OS.
 ua_os_major: The major version of the client OS.
 ua_os_minor: The minor version of the client OS.
 ua_os_patch: The patch version of the client OS.
 ua_os_patch_minor: The minor patch version of the client OS.
 ua_family: The name of the UA ("Firefox", "IE")
 ua_major: The major version of the UA.
 ua_minor: The minor version of the UA.
 ua_patch: The patch version of the UA
 ua_device: The type of device used in the event.

 ....




























2016年3月30日 星期三

Google Maps Add-on for Splunk Enterprise

https://splunkbase.splunk.com/app/368/

下載這個 APP google-maps-add-on-for-splunk-enterprise_113.tgz 並安裝它.
即可使用 geoip 的 搜尋語法.

host="web1" | geoip | search geoip_country_name="Hong Kong"