splunk常用命令Word文件下载.docx

上传人:b****6 文档编号:8632702 上传时间:2023-05-12 格式:DOCX 页数:12 大小:223.30KB
下载 相关 举报
splunk常用命令Word文件下载.docx_第1页
第1页 / 共12页
splunk常用命令Word文件下载.docx_第2页
第2页 / 共12页
splunk常用命令Word文件下载.docx_第3页
第3页 / 共12页
splunk常用命令Word文件下载.docx_第4页
第4页 / 共12页
splunk常用命令Word文件下载.docx_第5页
第5页 / 共12页
splunk常用命令Word文件下载.docx_第6页
第6页 / 共12页
splunk常用命令Word文件下载.docx_第7页
第7页 / 共12页
splunk常用命令Word文件下载.docx_第8页
第8页 / 共12页
splunk常用命令Word文件下载.docx_第9页
第9页 / 共12页
splunk常用命令Word文件下载.docx_第10页
第10页 / 共12页
splunk常用命令Word文件下载.docx_第11页
第11页 / 共12页
splunk常用命令Word文件下载.docx_第12页
第12页 / 共12页
亲,该文档总共12页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

splunk常用命令Word文件下载.docx

《splunk常用命令Word文件下载.docx》由会员分享,可在线阅读,更多相关《splunk常用命令Word文件下载.docx(12页珍藏版)》请在冰点文库上搜索。

splunk常用命令Word文件下载.docx

11

Inter9

Inter10

Inter11

3

Inter12

15

Inter13

以下的命令解释都是以以上数据为例子

2Stats,chart,timechart统计类

stats、chart和timechart命令(及其相关的命令eventstats和streamstats)设计为与统计函数结合使⽤。

可⽤统计函数

包括:

●计数、⾮重复计数、总和countdcsum

●平均值、中值、模式avgmedianmode

●最⼩值、最⼤值、范围、百分⽐minmaxrangeperc

●标准偏差、⽅差stdevstdevpvarvarp

●最早出现、最晚出现firstlast

函数

描述

例子

avg(X)

返回多个事件中同一个字段(字段类型为数字)的平均值

Index=aaa|statsavg(responseTime)

取平均值为7.33

c(X)|count(X)

统计同一个字段的个数

Index=aaa|statscount(responseTime)

计数13

dc(X)|distinct_count(X)

统计同一个字段的个数(去重)

Index=aaa|statsdc(responseTime)

去重后计算字段个数为8

list(X)

ThisfunctionreturnsthelistofallvaluesofthefieldXasamulti-valueentry.Theorderofthevaluesreflectstheorderofinputevents.

Index=aaa|statslist(responseTime)

返回完整的列表

max(X)

返回字段的最大值.

Index=aaa|statsmax(responseTime)

返回最大值15

min(X)

返回字段的最小值.

Index=aaa|statsmin(responseTime)

返回最小值3

mode(X)

返回特定字段中出现频率最高的值

Index=aaa|statsmode(responseTime)

返回4出现频率最高

range(X)

返回字段中最大值与最小值之间的差

Index=aaa|statsrange(responseTime)

返回12,15-3

stdev(X)

取标准差

标准差

一组数据每个数分别减此组数据的平均数的差的平方,相加起来除此组数据个数,即标准差.平均数3则差计算公式:

[(1-3)^2+(2-3)^2+(3-3)^2+(4-3)^2+(5-3)^2]÷

5

sum(X)

ThisfunctionreturnsthesumofthevaluesofthefieldX.

Index=aaa|statssum(responseTime)

求和为88

values(X)

ThisfunctionreturnsthelistofalldistinctvaluesofthefieldXasamulti-valueentry.Theorderofthevaluesislexicographical.

Index=aaa|statsvalues(responseTime)

返回列表,去重

3搜索结果处理及过滤

3.1table:

表格化呈现

表格化

示例

index=kl|rexfield=_raw"

(?

P<

interfce>

\w*)\s+(?

responstime>

\d+)"

|tableinterfceresponstime

3.2reverse翻转,逆序

翻转,逆序

|tableinterfceresponstime|reverse

3.3sort按某字段升降序

按某字段升降序

|tableinterfceresponstime|sort-responstime

3.4head取前N个结果

取前N个结果

|tableinterfceresponstime|sort-responstime|head5

3.5tail取后N个结果

取后N个结果

|tableinterfceresponstime|sort-responstime|tail5

3.6dedup去重

去重

|dedupresponstime|tableresponstime

3.7search搜索某字段里包括特定字符的结果

搜索某字段里包括特定字符的结果

interface>

|searchinterface=*inter1*

搜索端口里包括*inter1*的结果

3.8top,rare按某字段值出现频率排序

按某字段值出现频率排序,TOP降序,RARE升序

|toplimit=8responstime

|rarelimit=8responstime

4Eval非常重要的命

格式:

….|evalY=fun(x)

4.1逻辑判断

4.1.1isint(X),isnum(X),isstr(X),isbool(X)

判断类型是否为int、数字、字符串或布尔

4.1.2cidrmatch("

X"

Y)CIDR匹配

判断一个IP地址是否属于某个CIDR子网,X是子网号,Y是字段(字段内容肯定得是IP才行)

必须和IF嵌套

index="

cmb_si_trans"

|evaladdy=if(cidrmatch("

183.60.0.0/16"

source_ip),"

yes"

"

no"

)|tablesource_ipaddy|sort-addy

4.1.3searchmatch(X)在事件寻找特定字符串

在事件寻找特定字符串,

...|evaln=searchmatch("

fooANDbar"

)作简单判断,是或否

|evalp1start=if(searchmatch("

step1"

),_time,null()) 

如果包含“step1”,则返回这个事件中的_time,否则返回null

4.2字符串处理

4.2.1lower(X),upper(x)大小写转换

大小写字母

4.2.2ltrim,trim,rtrim字符削减

修剪左边、右边或全字段中的特定字符

...|evalx=ltrim("

ZZZZabcZZ"

"

Z"

)返回abcZZ

...|evalx=rtrim("

)返回ZZZZabc

...|evalx=trim("

)返回abc

4.2.3split(X,"

Y"

)字段分离

sourcetype="

cisco_esa"

mailfrom=*|evalaccountname=split(mailfrom,"

@"

)|evalfrom_domain=mvindex(accountname,-1)|evallocation=if(match(from_domain,"

[^s]+.(com|net|org)"

),"

local"

abroad"

)|statscountbylocation

4.2.4len(X)返回字段长度

4.3结构化

4.3.1Case

case的字符串不能用正则匹配

...|evaldescription=case(error==404,"

Notfound"

error==500,"

InternalServerError"

error==200,"

OK"

4.3.2if(X,Y,Z)

...|evalerr=if(error==200,"

Error"

4.4时间运算

4.4.1strftime(X,Y)将UNIX时间还原成标准可读时间

将UNIX时间还原成标准时间

...|evaln=strftime(_time,"

%H:

%M"

%p%I:

%M%Y/%m/%d%A

index=sufe

|evalnow=strftime(now(),"

%M%Y/%m/%d%A"

|tablenow

4.4.2time()返回事件被eval处理时的时间

返回事件被eval处理时的时间,微秒-6次方

index=sufe|evaltime=_time|evalnow=time()|table_timetimenow

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 高等教育 > 理学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2