首页 \ 问答 \ 使用logstah解析范围请求标头(Parsing range request header with logstah)

使用logstah解析范围请求标头(Parsing range request header with logstah)

我需要将范围请求值解析为logstash中的start_range和end_range。 数据来自json对象,如下所示:

byte_range: "bytes=10-200"

我想将start和end提取为单独的值,如下所示:

start_range:10
end_range:200

我还需要考虑到值可能如下所示:

byte_range: "bytes=10-"

并且仍然应该导致:

start_range: 10
end_range: -

我尝试使用grok过滤器这样做,但它不起作用:

bytes=%{NUMBER:start_range}-%{NUMBER:end_range}

有没有人知道如何尽可能简单地解决这个问题?


I need to parse a range request value into start_range and end_range in logstash. The data comes from a json object and looks like this:

byte_range: "bytes=10-200"

and I want to extract start and end into separate values like this:

start_range:10
end_range:200

I also need to take into account that the value could look like this:

byte_range: "bytes=10-"

and should still result in:

start_range: 10
end_range: -

I tried doing it like this with a grok filter but it does not work:

bytes=%{NUMBER:start_range}-%{NUMBER:end_range}

Does anyone have any idea how to solve this as simple as possible?


原文:https://stackoverflow.com/questions/42010430
更新时间:2023-05-11 12:05

最满意答案

您需要将表连接在一起并应用DISTINCT

SELECT DISTINCT p.PrdNo, p.PrdName, o.OrdState
FROM Product AS p
INNER JOIN OrderList AS ol ON p.PrdNo = ol.PrdNo
INNER JOIN Orders AS o ON o.OrdNo = ol.OrdNo
WHERE o.OrdState = 'CA'
ORDER BY PrdName

在这里演示


You need to join the tables together and apply DISTINCT:

SELECT DISTINCT p.PrdNo, p.PrdName, o.OrdState
FROM Product AS p
INNER JOIN OrderList AS ol ON p.PrdNo = ol.PrdNo
INNER JOIN Orders AS o ON o.OrdNo = ol.OrdNo
WHERE o.OrdState = 'CA'
ORDER BY PrdName

Demo here

相关问答

更多
  • SELECT NAME, CASE WHEN seq > 1 THEN '' ELSE manager END AS Manager, CASE WHEN seq > 1 THEN '' ELSE dept END AS dept FROM (SELECT b.NAME,b.dept,a.NAME AS manager, Row_number()OVER(partition BY a.dept ORDER BY a.dept DESC) seq FROM complex a JOIN c ...
  • 您需要将表连接在一起并应用DISTINCT : SELECT DISTINCT p.PrdNo, p.PrdName, o.OrdState FROM Product AS p INNER JOIN OrderList AS ol ON p.PrdNo = ol.PrdNo INNER JOIN Orders AS o ON o.OrdNo = ol.OrdNo WHERE o.OrdState = 'CA' ORDER BY PrdName 在这里演示 You need to join the tabl ...
  • 为什么你需要加入? 将COUNT()与GROUP BY将为您提供相同的所需结果: SELECT item_name, COUNT(*) AS count FROM stocks GROUP BY item_name; Why do you need a join at all? Using COUNT() with a GROUP BY will provide you with the same desired result: SELECT item_name, ...
  • 以下是使用聚合的一种方法: select user_id, 2 from roles r group by user_id having min(role_id) = 2 and min(role_id) = max(role_id); 如果role_id可能为NULL ,则可以将其调整为: having min(role_id) = 2 and min(role_id) = max(role_id) and count(role_id) = count(*) Here is one method us ...
  • 这个查询世界为你工作可能是语法错误,因为我没有数据库。 select SUBSTRING_INDEX(full, ' ', 1) AS email ,SUBSTRING_INDEX(full, ' ', -1) AS cliente_id , nome from (SELECT DISTINCT (concat(c.email as email,' ',pf.id_cliente )) as 'full' , c.nome as 'nome' FROM cliente c INNER JOIN pesso ...
  • 你需要的是一个join和一个group by子句,如下所示: SELECT t.empNo,t.empName,t.empCommRate,count(distinct s.ordNo) as Total FROM Employee t INNER JOIN Orders s ON(t.empNo = s.empNo) WHERE t.empCommRate < 0.040 GROUP BY t.empNo,t.empName,t.empCommRate 它也可以使用这样的相关查询来完成: SELECT ...
  • 试试这个, SELECT a.* FROM tableName a INNER JOIN ( SELECT transactionID, MIN(item) minItem FROM tableName GROUP BY transactionID ) b ON a.transactionID = b.transactionID AND ...
  • 您可以使用Select-String和Unique参数消除重复: $text='folders' Get-ChildItem C:\Workspace\mydirectorytosearch1\,C:\Workspace\mydirectorytosearch2\ -Recurse -Filter '*.ps*1' | Select-String -Pattern $text | Where-Object {$_ -NotLike '*.invoke(*'} | Select-Object Path -U ...
  • 您可以使用OUTER APPLY (另外,您应该尝试找出您真正想要的条形码): SELECT i.id, b.barcode FROM inventory i OUTER APPLY (SELECT TOP 1 * FROM barcodes WHERE id = i.id ORDER BY barcode) b; You can use OUTER APPLY (also, you should actual ...
  • 在我看来,你有一个给定的表B实体的多个表A记录,是吗? 顺便说一下,你的列名很糟糕...... table_B.id = table_A.TA_user ???? 如何检查您的数据库应该知道存在这种关系? 但这不是重点。 无论如何,我猜你是否试图返回在给定日期的table_A中有记录的表B实体? 如果是这样,不同应该对你有用。 我可能会使用group by,因为它通常更快。 但如果我理解正确的话,这应该做你想要的。 SELECT DISTINCT table_B.TB_name FROM table ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)