Skip to main content

Splunk : queries


1.SPL Keywords 

ByAs | over | where|  or |


2.Command chaining

index ="AirBNB" | where Price > 40

index="AirBnB" Neighborhood Queens "Property Type"= Apartment | where Price >70 or Price =65
________________________________________________________________
3.SPL Filtering and Modifying 
  • Field
  • Search
  • Rename
Fields : Add/Subtract fields that we want to show in our search

index="AirBnB Neighborhood =Queens "Property Type"= Apartment | field -bed

index="AirBnB Neighborhood =Queens "Property Type"= Apartment | field +bed,price

search : searches for raw text

index="AirBnB Neighborhood =Queens "Property Type"= Apartment | search large

rename : rename a field for raw text

index="AirBnB Neighborhood =Queens "Property Type"= Apartment | search large |rename Price as Cost
________________________________________________________________

Ordering
  1. Head
  2. Tail
  3. sort
  4. reverse
  5. Table 
Head
index="AirBnB Neighborhood =Queens "Property Type"= Apartment | search large |head 20

Tail
index="AirBnB Neighborhood =Queens "Property Type"= Apartment | search large |tail 30

sort
index="AirBnB Neighborhood =Queens "Property Type"= Apartment | search large |sort Price desc

reverse
index="AirBnB Neighborhood =Queens "Property Type"= Apartment | search large |rename Price as Cost

Table 
index="AirBnB Neighborhood =Queens "Property Type"= Apartment | search large |rename Price as Cost
_______________________________________________________________

Transformative commands allow search commands to create data structure from field values.

Top : most frequent values
index=airbnb | top limit 3 beds
Rare: least frequent values
index=airbnb | rare limit 3 beds
Highlight
Contingency
index=airbnb | contingency Neighborhood  "Property Type"

Stats commands

Special type of transforming commands used primarily for calculations to for table results

|stats avg([fieldname])
calculate results based on average function
index=airbnb | stats avg(Price)
index=airbnb | stats avg(Price) by Neigbourhood 

Find number of listings by neighborhood
|stats count(eval[fieldname]) as new name . : returns timeseries chart over the data element 
index=airbnb | stats count

index=airbnb | stats count by Neigbourhood 

Find maximum  listing by price neighborhood
|stats max(fieldname) : returns maximum value for a specific field index=airbnb | stats max(Price)
index=airbnb | stats mav(Price) by Neighbourhood


Find min of listings by neighborhood
|stats min(fieldname) : returns minimum value for a specific field
index=airbnb | stats min(Price) 
index=airbnb | stats min(Price) by Neighbourhood

Find maximum of listings in neighborhood
|stats sum(fieldname) : returns sum value for a specific field

Chart commands


Type of splunk transforming command for presenting data in tables or visualization . Typically include stats commands

|chart somefunction([fieldname]) as new name  

|timechart somefunction([fieldname]) as new name 


Find the type of property listed by property type

index=airbnb | chart count as types by "Property Type"













host="tvidushi" | timechart count as messages  by keywords 

















What is SPLUNK LOOK UP ?


Splunk is a software used to search and analyze machine data. It has built-in features to recognize the data types, field separators and optimize the search processes. It also provides data visualization on the search results.

Splunk can read this unstructured, semi-structured or rarely structured data. After reading the data, it allows to search, tag, create reports and dashboards on these data. With the advent of big data, Splunk is now able to ingest big data from various sources, which may or may not be machine data and run analytics on big data.


source type detection

























Comments

Popular posts from this blog

Microservices Design patterns

What are microservices? Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of services that are Highly maintainable and testable Loosely coupled Independently deployable Organized around business capabilities Owned by a small team The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack. You are developing a server-side enterprise application. It must support a variety of different clients including desktop browsers, mobile browsers and native mobile applications. The application might also expose an API for 3rd parties to consume. It might also integrate with other applications via either web services or a message broker. The application handles requests (HTTP requests and messages) by executing business logic; accessing a database; exchanging messages with other systems; and returni...

GraphQL

What is GraphQL  API Standard invented & open-sourced by Facebook Alternative to  REST API  enables declarative data fetching  exposes single endpoint & responds to queries How it works?  Why Graphql? Improvises performance by reducing the data that is to be transferred over the internet Variety of different frontend frameworks and platforms on client-side Fast development speed & expectation for rapid feature development Why Graphql is better than REST? Flexibility & efficient  No more over /under fetching of data Over fetching : Under fetching: Insightful analytics  Schema serves as contract between client and server CORE CONCEPTS : SDL :SCHEMA DEFINITION LANGUAGE Writing Data with mutations 3 kinds of mutations creating new data updating existing data deleting existing data

Jackson

<dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId> jackson-core </artifactId> <version>2.9.6</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId> jackson-annotations </artifactId> <version>2.9.6</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId> jackson-databind </artifactId> <version>2.9.6</version> </dependency> CBOR encoded data with Jackson <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-cbor</artifactId> <version>2.9.6</version> </dependency> In order to read and write MessagePack encoded data <dependency> <groupId>org.msgpack</groupId> <artifactId>jackson-dataformat-msgp...