Team,
I am New to Elastic Stack and need your help to setup the same in my environment.
Setup : We are planning to disable Stackdriver logging in our Google Cloud Platform and instead we want to use ELK to display these logs for us.
Input : Google Pub/Sub --> We have created Sinks/Exports through which we are sending logs to the Logstash.
I have used Google Pub/Sub Input Plugin for my Logstash and is as below
input {
google_pubsub {
project_id => "mobile"
topic => "elk"
subscription => "elk"
}
}
Stackdriver sends Input as JSON Format to the Logstash and I can see the message Field as Below :
LOG TYPE 1 :
{"insertId":"10d40fnf47vfwr","labels":{"compute.googleapis.com/resource_name":"fluentd-gcp-v3.1.0-6qrhl","container.googleapis.com/namespace_name":"a-dev","container.googleapis.com/pod_name":"a-28-59d8c67bf9-6mxv9","container.googleapis.com/stream":"stdout"},"logName":"projects/mobile/logs/a-springboot","receiveTimestamp":"2019-02-22T18:24:20.827627762Z","resource":{"labels":{"cluster_name":"mobile","container_name":"a-springboot","instance_id":"94838654749378","namespace_id":"a-dev","pod_id":"a-28-59d8c67bf9-6mxv9","project_id":"mobile","zone":"us-central1-b"},"type":"container"},"severity":"INFO","textPayload":%IP - - [25/Feb/2019:12:48:14 +0000] "GET /health HTTP/1.1" 200 - 7 "http://101.34.0.12:80/health" "kube-probe/1.11+" "-" Correlation-ID="-" x-channel="-"}
LOG TYPE 2 :
{"insertId":"10d40fnf47vfwr","labels":{"compute.googleapis.com/resource_name":"fluentd-gcp-v3.1.0-6qrhl","container.googleapis.com/namespace_name":"a-dev","container.googleapis.com/pod_name":"a-28-59d8c67bf9-6mxv9","container.googleapis.com/stream":"stdout"},"logName":"projects/mobile/logs/a-springboot","receiveTimestamp":"2019-02-22T18:24:20.827627762Z","resource":{"labels":{"cluster_name":"mobile","container_name":"a-springboot","instance_id":"94838654749378","namespace_id":"a-dev","pod_id":"a-28-59d8c67bf9-6mxv9","project_id":"mobile","zone":"us-central1-b"},"type":"container"},"severity":"INFO","textPayload":"51038.335: [CMS-concurrent-abortable-preclean: 0.000/0.000 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] \n","timestamp":"2019-02-23T05:59:14Z"}
How Can I break this down so that I can get all the fields ? For example :
"insertId":"10d40fnf47vfwr"
"receiveTimestamp":"2019-02-22T18:24:20.827627762Z"
If not, how is it Possible to only break text payload field and parse multiple log formats ? if you see above I have 2 different Payload with 2 different formats.. Like this I have multiple formats when it comes to payload
Also, when it comes to text payload, we have different formats of the logs.. so is it possible to match ?