How to pass variable from Logstash filter into ruby parameter


I'm trying to create a variable which holds information from input file path. I'm able to do so for example for creating index in Kibana but I'm unable to pass this variable into ruby /plugin/ code. Anyone knows what I'm doing wrong here?

Thanks in advance

here I'm creating variable PK from file path

    grok {
      match => {
        "[log][file][path]" => ["(?:%{BASE10NUM:PK}-)"]

Here I'm trying to pass it into ruby as parameter

      ruby {
        path => "/usr/local/supporting-scripts/webhook.rb"
        script_params => {
        "primary_key" => "PK"

I have tried different possibilities like

"[PK]"; "%{[PK]}"; "[PK]"; 

nothing worked