Splunk dbxquery 使用子搜索调用存储过程以填充参数不起作用

Splunk dbxquery to call stored procedure with subsearch to populate parameter not working

我有两个有效的 Splunk 查询,如下所示。

第一个接受 IP 地址和日期时间以及 returns Mac 地址:

index=dhcp signature=DHCPACK dest_ip="192.0.0.0" latest="05/30/2018:00:00:00"| rename dest_mac as mac_address | table mac_address, _time | sort - _time | head 1 | fields mac_address

第二个调用数据库中的存储过程并传入mac地址和日期时间以及returns一个machine id,它是一个guid:

| dbxquery query="EXEC [dbo].[get_machines_by_mac_date] @mac_address = '11:22:33:44:55:66', @utc_date_time = '05/30/2018'" connection="database1"

我需要做的是将这两个组合成一个查询,其中在第一个中找到的 Mac 地址作为 mac_address 参数传递给第二个。我一直在研究这个,我认为我已经很接近了,但是它不能正常工作,这是我的组合查询:

| dbxquery query="EXEC [dbo].[get_machines_by_mac_date] @mac_address = [index=dhcp signature=DHCPACK dest_ip="192.0.0.0" latest="05/30/2018:00:00:00"| rename dest_mac as mac_address | table _time, mac_address | sort - _time | head 1 | return mac_address], @utc_date_time = '05/30/2018'" connection="database1"

我读到内部查询(在方括号内)首先执行,所以我试图在外部查询中提供 mac_address 参数和内部查询的结果。

我一直收到错误消息,说 mac_address 太长,数据库中的最大长度是 128。我很确定这意味着内部查询不工作,它是尝试将方括号内的整个文字文本字符串发送到存储过程。

这是我尝试 运行 查询时返回的错误:

com.microsoft.sqlserver.jdbc.SQLServerException: The identifier that starts with 'index=dhcp signature=DHCPACK dest_ip=192.0.0.0 latest=05/30/2018:00:00:00| rename dest_mac as mac_address | table _time, ma' is too long. Maximum length is 128.

我是 Splunk 的新手,如果能提供任何帮助,我将不胜感激!

我能够从 Splunk 获得帮助,但我的查询不正确。我没有使用方括号作为子搜索,而是需要将 dest_mac 参数从查询 1 映射到查询 2,这是有效的组合查询:

index=dhcp signature=DHCPACK dest_ip=192.0.0.0 latest=05/30/2018:00:00:00 
| table dest_mac 
| sort- _time | head 1 | map search=\" 
| dbxquery procedure=\\"{{call get_machines_by_mac_date(?,?)}}\\" 
connection=\"database1\" params=\\"\\"$dest_mac$\\", 05/30/2018\\"\"