Splunk 取得License使用量

假設是要取得目前使用量
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

基本上就是限制starttime的起始為當日的00:00:00
(starttime format為 %m/%d/%Y:%H:%M:%S)

如果是要取得最近幾天的License Usage
index=_internal source=*license_usage.log type=RolloverSummary earliest=-7d
| eval GB = b/1024/1024/1024
| eval _time = _time - 43200
| timechart span=1d sum(GB) AS "Total GB used"

Ref Site: http://splunk-base.splunk.com/answers/65311/daily-license-usage-by-index-across-all-indexers

Posted in Splunk | Leave a comment

Ping 前面加上時間戳記

其實寫程式或是架Smokeping就好了,不過就是懶…
以下是網路上搜尋到的寫法 (來源)

Dim args, flag, unsuccOut
args=""
otherout=""
flag=0
If WScript.Arguments.count = 0 Then
    WScript.Echo "Usage: cscript tping.vbs [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]"
    WScript.Echo "                         [-s count] [[-j host-list] | [-k host-list]]"
    WScript.Echo "                         [-r count] [-w timeout] destination-list"
    wscript.quit
End if
For i=0 to WScript.Arguments.count - 1
    args=args & " " & WScript.Arguments(i)
Next
Set shell = WScript.CreateObject("WScript.Shell")
Set re=New RegExp
re.Pattern="^Reply|^Request|^回覆自"
Set myping=shell.Exec("ping" & args)
while Not myping.StdOut.AtEndOfStream
    strLine=myping.StdOut.ReadLine()
    r=re.Test(strLine)
    If r Then
        WScript.Echo date & " "& time & chr(9) & strLine
        flag=1
    Else
        unsuccOut=unsuccOut & strLine
    End if
Wend
if flag = 0 then
    WScript.Echo unsuccOut
end if

用法為 cscript 本程式名稱 [參數]

Posted in Windows | Leave a comment

PowerPoint巨集,將物件移到最前面

查詢物件名稱

Sub Who_AM_I()
    With ActiveWindow.Selection.ShapeRange(1)
        MsgBox .Name
    End With
End Sub

將物件移到最前面

Sub Bringtofront()
    ActivePresentation.Slides(第幾張投影片).Shapes("物件名稱").ZOrder msoBringToFront
End Sub
Posted in Office, PowerPoint | Leave a comment

MySQL Process

秀出 Process list

 show processlist 

刪除 PID

 kill 

秀出目前版本

 SELECT VERSION()G 
Posted in MySQL | Leave a comment

Splunk Mail2000 Log Source Type

vim /opt/splunk/etc/system/local/props.conf


[mail2000_access]
NO_BINARY_CHECK = 1
pulldown_type = 1

[mail2000_imap]
NO_BINARY_CHECK = 1
pulldown_type = 1

[mail2000_imss]
NO_BINARY_CHECK = 1
pulldown_type = 1

[mail2000_login]
NO_BINARY_CHECK = 1
pulldown_type = 1

[mail2000_mailer]
NO_BINARY_CHECK = 1
pulldown_type = 1

[mail2000_pop3]
NO_BINARY_CHECK = 1
pulldown_type = 1

[mail2000_smtp]
NO_BINARY_CHECK = 1
pulldown_type = 1

[mail2000_imss]
NO_BINARY_CHECK = 1
pulldown_type = 1
Posted in Linux, Splunk | 1 Comment

Linux 自動設定 +1 天的日期

Linux 自動設定 +1 天的日期

 date $(date -d'1 day' +"%m%d%H%M%Y") 
Posted in Linux | Leave a comment

split 切割檔案

使用方法: split [OPTION] [INPUT [PREFIX]]
  -a, --suffix-length=N   use suffixes of length N (default 2)
  -b, --bytes=SIZE        put SIZE bytes per output file
  -C, --line-bytes=SIZE   put at most SIZE bytes of lines per output file
  -d, --numeric-suffixes  use numeric suffixes instead of alphabetic
  -l, --lines=NUMBER      put NUMBER lines per output file
      --verbose           print a diagnostic to standard error just
                            before each output file is opened
      --help     display this help and exit
      --version  output version information and exit 

範例: 將 100000000 行的檔案 abc.log 分為多個檔案,每個檔案只有 5000 行

 split -l 5000 abc.log abc.split.log 

就會產生 abc.split.log.xx、abc.split.log.xy。。。檔案

Posted in Linux | Leave a comment

[Splunk] 修改Google MAP模組圖示的Height值

vim /opt/splunk/etc/apps/maps/default/data/ui/views/maps.xml 

搜尋 ( 在module name=”GoogleMaps” 階層內)
預設值為 500px
可以視需要修改

Posted in Linux, Splunk | Leave a comment

[筆記] rsync

rsync的密碼檔權限必須是 600……
因為這一個miss….一個同步卡了一個多月都沒成功XD

Posted in Linux | Leave a comment

搜尋內文

為了要尋找Redmine的語系檔案…爬了一下網路
除了老妖怪說的locate尋找檔名(必須先updatedb)外
尚可以使用grep進行

 grep -Rs '搜尋文字'

-R => 搜尋路經包含子目錄
-s => 遇到錯誤、檔案不存在時不秀出資訊

Posted in Linux | Leave a comment