Convert Text to Numeric Field


(Riaan) #1

Hi Community,

I am new to graylog.This question must have been asked a thousand times, yet a still confused a bit

i followed the documentation and through trial and error I was able to extract the value i was looking for using regex

This is a extract from the log:
100%, RSSI: -52(dBm)

This was my regex
RSSI:.*?(\d+)

And I got my value
52

Now that i have this value and it it shown in my fields list it makes life much easier. However I am unable to properly graph it since it is a text field instead of long etc.

How would i change that field?

This is what the mapping excerpt looks like using
curl -X GET http://127.0.0.1:9200/graylog_0/_mapping?pretty

  "rssi_signal" : {
        "type" : "keyword"
      },

Any one have a quick explanation of how to change the type to long instead of keyword?

Also I am running version: graylog-server-2.4.6


(Riaan) #2

Will something like this work for the template?

{
	"template": "graylog_*",
	"mappings": {
		"message": {
			"properties": {
				"rssi_signal": {
					"type": "long"
				}
			}
		}
	}
}

(Riaan) #3

I answered my own question. But still a good example to other newbies


(system) #4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.