Author Archives: cowman.chiang

htaccess ( apache 存取控制 )

修改 /etc/httpd/conf/httpd.conf <Directory “/var/www/html”> # # Possible values for the Options directive are “None”, “All”, # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that “MultiViews” must be named *explicitly* — “Options All” # … Continue reading

Posted in Apache | Leave a comment

Splunk – Transaction 查詢一段相近時間之累積資訊

sourcetype=”來源型態” | rex “(?i) .? User (?P<pop3_failed_id>[^.]+) login failed.” | search pop3_failed_id=”” | transaction 判斷資訊 maxevents=2000 keepevicted=true | concurrency duration=duration | eval duration=tostring(duration,”duration”) 原理有點像是將所有事件跑過一次,然後把相近時間的判斷資訊放在同一筆事件中 一般預設單筆事件僅顯示500筆資訊 但是有時候可能會是好幾萬筆資訊就會被拆成好幾筆事件,將造成事件數字判讀上的不便 因此可以進行下面的動作 將 /opt/splunk/etc/apps/search/default/data/ui/views/flashtimeline.xml 檔案複製到 /opt/splunk/etc/apps/search/local/data/ui/views/flashtimeline.xml 編輯 /opt/splunk/etc/apps/search/local/data/ui/views/flashtimeline.xml 搜尋 在下面插入 數字 會變成 數字 full report_builder_format_report … Continue reading

Posted in Splunk | Leave a comment

Splunk Lincese Warning 次數

除了可以到 “管理員=>授權” 去查看外 還可以搜尋 “index=_internal licensemanager” 根據搜尋的結果看 Audit:[quotaExceededCount=1 的數量 所以便可以擷取欄位 將 (?i) Audit:[quotaExceededCount=(?P[^,]+) 存為記得的名稱以便後續搜尋

Posted in Splunk | Leave a comment

強制把 80 轉到 443

編輯 httpd.conf 在 # End of proxy directives. 後加入下面幾句 (應該是加在哪裡都ok) RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^/?(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R] 不過需先確認是否有載入下面這個module LoadModule rewrite_module modules/mod_rewrite.so

Posted in Linux | Leave a comment

重設root密碼

之前忘記root密碼時都是修改GRUB進單人模式修改 開機 -> e -> 選擇kernel -> e -> 最後加入”single”或是”-s” 不過這次遇到一個囧境 因為修改系統時間導致fsck error…需要修正 這時候就需要root密碼….但是我一開始並沒有設定root密碼= =+ 進單人模式一樣先跳出fsck error….Orz 這時候就只能用外接的方式處理了…. 如果是用Live CD開機 命令字元 -> “su -” -> “mkdir /mnt/system” -> “mount /dev/sda2 /mnt/system” -> “chroot /mnt/system” -> passwd 重設密碼 如果是用安裝光碟開機 輸入 “linux … Continue reading

Posted in Linux | Leave a comment

SED

刪除第一行 sed ‘1d’ 文件 刪除第一個字元 sed ‘s/^.//’ 文件 刪除最後一個字元 sed ‘s/.$//’ 文件 假設要寫在一起,用”;”連結 sed ‘1d;s/^.//;s/.$//’ 文件

Posted in Linux | Leave a comment

Splunk CLI With Script

因為 Splunk CLI 一樣需樣登入 所以可以先在 Script 檔案中預先輸入帳號、密碼 export SPLUNK_USERNAME=帳號 export SPLUNK_PASSWORD=密碼 然後在下 Splunk 的登入、查詢等指令 /opt/splunk/bin/splunk login /opt/splunk/bin/splunk search ‘index=_internal source=*metrics.log group=per_index_thruput NOT (series=_* OR series=*summary) starttime=02/07/2013:00:00:00 | timechart span=1d sum(eval(kb/1024)) AS “MB indexed” by series | fields + main | … Continue reading

Posted in Splunk | Leave a comment

設定元件Visible屬性

Sub Picture25_visible() With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex) If .Shapes.Title.TextFrame.TextRange.Text = “Splunk 優點” Then .Shapes(“圖片 25”).Visible = -1 .Shapes(“圖片 25”).ZOrder msoBringToFront End If End With End Sub Sub Picture25_hide() With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex) If .Shapes.Title.TextFrame.TextRange.Text = “Splunk 優點” Then .Shapes(“圖片 25”).Visible = msoFalse End If End … Continue reading

Posted in Office, PowerPoint | Leave a comment

當投影片切換時 (VBA)

Sub OnSlideShowPageChange() MsgBox ActivePresentation.Slides(ActiveWindow.Selection.SlideRange.SlideNumber).Shapes.Title.TextFrame.TextRange.Text End Sub

Posted in Office, PowerPoint | Leave a comment

Powerpoint VBA: 取得當前Slide編號

主要有兩種 1. ActiveWindow.Selection.SlideRange.SlideNumber 此處主要是在一般狀態下 (非簡報播放) 適合用來Debug 2. SlideShowWindows(1).View.Slide.SlideIndex 此處主要是當簡報播放情況下 ( 所以一般Debug模式會出錯 ) 以下為實際應用 Sub Picture76_4() With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex) If .Shapes.Title.TextFrame.TextRange.Text = “Splunk for Unix and Linux” Then .Shapes(“Picture 4”).ZOrder msoBringToFront End If End With End Sub Sub Picture76_5() With ActivePresentation.Slides(ActiveWindow.Selection.SlideRange.SlideNumber) MsgBox … Continue reading

Posted in Office, PowerPoint | Leave a comment