I have this kind of log 21.4.1.2 - - [28/Dec/2016:12:18:40 +0000] "GET a/b/c/d/e/f HTTP/1.1" 200 984072 "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36" 0.104 0.103 . Now how should I extract this using grok pattern ? I dont know the no of fields also i.e. rest api can be a/b/c also and a/b/c/d/e/f/g also. How should I handle it so that I can group by a,b or c in kibana.
what is the right way to extract rest api's in logstash
704 Views Asked by agrawal1084 At
2
There are 2 best solutions below
0
Derrick
On
There is a %{GREEDYDATA:value} grok template that you can use to extract the API path part, from there you could split on "/". This tool can be useful when debugging grok patterns http://grokdebug.herokuapp.com/.
So start with:
%{IP:clientip} \- \- \[%{NOTSPACE:date} \+%{INT}\] \"%{WORD:action} %{GREEDYDATA:api} %{WORD:protocol}/%{NUMBER:protocolNum}\" %{NUMBER:status} %{NUMBER} %{QUOTEDSTRING} %{NUMBER} %{NUMBER}
Which will give you the api path in the api field.
Alternatively, we are working on Moesif which is an API debug and analytics tool (https://www.moesif.com/features) which may be helpful for you depending on what you require. (Full disclosure, I am the CEO)
Related Questions in REST
- Spring RestTemplate passing the type of the response
- .net rest service with JSON string and consumed with java client
- SuiteCRM how to retrieve all account related contacts
- http status code for failed email send
- cloud foundry - 413 Request Entity Too Large
- Why does PHP add "\r\n" to an empty string?
- WCF Service not accepting multiple body parameters
- How to send Rest GET request that contains "#" value in url parameters?
- Phalcon PHP - RESTful API
- Object of class CS_REST_Wrapper_Result could not be converted to string in CAMPAIGN MONITOR
- purchase individual items and subscriptions in the same PayPal REST API transaction
- Empty Response Received on Android POST Request
- angular load more tweets onclick
- Async vs Horizontal scaling
- Responding to an Office 365 event invite via REST
Related Questions in ELASTICSEARCH
- Elasticsearch schema for multiple versions of the same text
- Elasticsearch nested filter query
- Elasticsearch data model
- search with filter by token count
- Usage of - operator in elasticsearch
- Running multiprocessing on two different functions in Python 2.7
- How to get an Elasticsearch aggregation with multiple fields
- How to implement custom sort in elasticsearch?
- Custom Analyzer not working Elasticsearch
- How to implement full text search using Elasticsearch in Rails?
- UnresolvedAddressException in Logstash+elasticsearch
- Elasticsearch Fiddler No DNS
- Monolithic ETL to distributed/scalable solution and OLAP cube to Elasticsearch/Solr
- how to disable page query in Spring-data-elasticsearch
- Create Custom Analyzer after index has been created
Related Questions in KIBANA
- How to know the dependencies of an application in kibana 4?
- Customizing Kibana 4
- How to customize Kibana dashboard?
- Cannot select a pattern as defaultIndex on Kibana
- What is better: logStash agents on the appserver or the remote kibana server?
- Kibana histogram - Multiple, parameterized lines on a single chart
- Search for parse errors in logstash/grok
- Kibana 4 proxy dashboard embedding
- how to add geo_point type data to elasticsearch from logstash?
- Unable to fetch mapping. Do you have indices matching the pattern? Windows
- Setup elastic for production
- ELK queries - multiple query params
- How to smoothly load 200MB data to browser for visualization?
- How to get log message in separated field whih logstash
- Official Dockerfile uses apt-get commands
Related Questions in LOGSTASH-GROK
- Grok parse error when using custom pattern definitions
- Parsing multiline log file in Logstash
- Regex Fails when space is removed in grok debugger
- Logstash: Reading multiline data from optional lines
- Logstash grok pattern field not appearing in Kibana
- regex - Match filename with or without extension
- Parse logs containing python tracebacks using logstash
- Logstash Grok Filter Spit and put in seperate buckets in Elastic Index
- grok filter (regex) to extract string within square brackets
- No ‘Access-Control-Allow-Origin- http plugin logstash
- Post data to logstash using http input
- Hard to stash a log file with different occurrence of order for a field using Logstash
- Logstash - Add fields from the log - Grok
- kafka in logstash config and sending the output to ES
- How to split json value in log file using grok/regular expression
Related Questions in LOGSTASH-CONFIGURATION
- logstash dns filter miss
- Logstash not writing to Elasticsearch with Shield
- Parsing multiline log file in Logstash
- How to parse a xml-file with logstash filters
- Logstash. Get fields by position number
- Sending logs every 2 hours using logstash-forwarder without using cronjob
- Logstash exec input plugin - Remove command run from @message
- OS X: logstash works for a while and then stops with "Logstash shutdown completed" msg((
- Parse logs containing python tracebacks using logstash
- Logstash http module not sending message
- multiple indexer access to incomplete data
- No ‘Access-Control-Allow-Origin- http plugin logstash
- Why Elastic search is showing up only first 50 lines(events) in browser?
- Post data to logstash using http input
- Logstash Merge Field With Root Object
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
If there's a known depth, you could re-grok the URL field into those fields.
If there's an arbitary depth, mutate-split could make an array of them, but they wouldn't be useful.
How about the csv{} filter, which could take "/" as the separator and would produce you a bunch of fields called "column1", "column2", etc?