Splunk Overview

Extract Fields

Fields are the values that we awalys cares.

How to identify a field

A. extract by splunk ui

https://www.cnblogs.com/xiaozi/p/15960470.html

B. extract by regex in searching

[search vendors]

| rex "abc(?<field-name-A>.*)def"

| table field-name-A

the above command can extract field with the name: field-name-A from the search response

And then display in table format like:

https://docs.splunk.com/Documentation/SplunkCloud/9.2.2403/SearchReference/Table

d0af36f42f414adbbf7290b77ce61e56.jpg

 Common commands

eval

https://docs.splunk.com/Documentation/SplunkCloud/9.2.2403/SearchReference/Eval

Do pre-process for the whole raw

| eval _raw = replace(_raw, ":", "=")

Create new field

| eval new_field = fielda + fieldb

bf8f12cad40f4d7a81617579f90ebb0f.jpg

 Logic condition

operators:

255c9013675f44cea7e7d0750b36bc1c.jpg

 case:

|  eval description=case(status==200, "OK", status==404, "Not found", status==500, "Internal Server Error")

if:

... | eval error = if(status == 200, "OK", "Problem")

dedup

For one field which mapping to multipel row,

we may want to use dedup to unique the value.

| dedup fielda fieldb

coalesce

It will return the first no-empty value

| eval fielda = coalesce(field1, field2, field3)

rename

| rename fieldA as "test A"

join

... | join fieldA fieldB type="outer" [search vendors]

this command will outer join a search result when fieldA and fieldB between two source type are the same.

And I tried the command below, but never worked:

d4538dca3c614c42abb4d3bb32f85726.jpg

And we always recommand to use stats instead of join, for higher efficient.

stats

same as the "group by" in sql

follow conmands use it to do statistics, how many get in the data group by host

94170fd4df374e6cb82ed16d6a866772.jpg

 Internal function

eeb404b5ee7446d2aa26f92cb12cd474.jpg

372d0013b6394f8f852a582c6c9223bf.jpg 

 https://docs.splunk.com/Documentation/SplunkCloud/9.2.2403/SearchReference/Stats

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值