Nginx logs to Graylog, input extractors
04 Oct 2021To get the most out of Graylog we need to filter our log messages into separate fields. Those fields will later be used to create different searches which can be saved as a Dashboard widget.
Graylog Input extractors
Lets get started by going to System -> Inputs and press Manage extractors
for our Nginx Access logs
input.
Get started
to begin our journey to create our first extractor
Load Message
to load the last log message received to that input.
message
field.
select extractor type
on the message field and select Regular expression
.
Our first extractor will just remove the first “crap” nginx logs, the result is a pretty JSON string we can use in our next extractor. The result from our regular expression filter is stored in the new field we call json
. Use the Try
button to make sure your regular expression works as intended. When you are done just hit Create extractor.
When you have received a new message with our new json field. Go back to Manage Extractors and create a new one, after Load Message
step click Select extractor type
on the json field, and select JSON
.