我希望从多个节点导出日志文件(在我的情况下是apache访问和错误日志)并批量聚合这些数据,作为预定作业.我已经看到了多种与流数据一起使用的解决方案(即思考抄写员).我想要一个工具,让我可以灵活地定义目的地.这个要求来自于我想使用HDFS作为目的地.
我无法找到批量支持它的工具.在重新创建轮子之前,我想向StackOverflow社区询问他们的输入.
如果已经存在于python中的解决方案会更好.
我有一个包含两列的表:一对id和一对"标记".我想要一个结果,列出x每个值的标记或更多的夫妇的数量x.所以我的输入看起来像:
| couple_id | num_marks | |-----------+-----------| | 9 | 7 | | 6 | 6 | | 8 | 6 | | 2 | 5 | | 3 | 4 | | 5 | 4 | | 1 | 3 | | 4 | 3 | | 10 | 2 | | 7 | 1 |
我想得到结果:
| num_marks | num_couples | |-----------+-------------| | 7 | 1 | | 6 | 3 | | 5 …
我正在尝试使用JS API将动作发布到Facebook时间轴
FB.api('/me/application:action_type' + '?opject_type='+document.location.href,'post',
function(response) {
if (!response || response.error) {
alert("error");
} else {
alert("success");
}
});
Run Code Online (Sandbox Code Playgroud)
发布工作得很好,API没有返回错误.时间轴上会显示一个新活动,但仅显示为"最近活动"框中的小文本,如下所示:

如果操作未显示在操作类型设置的附件预览中,可能会出现什么问题?看起来像这样:

我已经链接了对象类型中的所有属性,并使用Facebook调试工具测试了我的对象URL, 看起来所有属性都可以被Facebook刮刀正确解析.
我还为操作类型定义了聚合布局.那么没有显示附件的原因是什么?
javascript aggregation facebook-graph-api facebook-timeline facebook-opengraph
我积极地使用脚本进行评分和聚合.我无法弄清楚的一件事是如何从脚本中发出日志.我试过console.log,但后来没有成功.请告诉我,我如何从我的groovy脚本中发出日志.
我们发现了一些与感染有关的域名.现在我们在.json文件中有一个DNS名称列表,我想生成一个汇总输出,显示:用户列表,他们访问的唯一域,总计数.如果我也可以计算每个域名的奖励积分.
以下是该文件的示例:
{"machine": "possible_victim01", "domain": "evil.com", "timestamp":1435071870}
{"machine": "possible_victim01", "domain": "evil.com", "timestamp":1435071875}
{"machine": "possible_victim01", "domain": "soevil.com", "timestamp":1435071877}
{"machine": "possible_victim02", "domain": "bad.com", "timestamp":1435071877}
{"machine": "possible_victim03", "domain": "soevil.com", "timestamp":1435071879}
Run Code Online (Sandbox Code Playgroud)
理想情况下,我希望输出类似于:
{"possible_victim01": "total": 3, {"evil.com": 2, "soevil.com": 1}}
{"possible_victim02": "total": 1, {"bad.com": 1}}
{"possible_victim03": "total": 1, {"soevil.com": 1}}
Run Code Online (Sandbox Code Playgroud)
我很乐意接受:
{"possible_victim01": "total": 3, ["evil.com", "soevil.com"]}
{"possible_victim02": "total": 1, ["bad.com"]}
{"possible_victim03": "total": 1, ["soevil.com"]}
Run Code Online (Sandbox Code Playgroud)
我可以获得每个用户的总记录数,但是我丢失了域名列表:
cat sample.json | jq -s 'group_by(.machine) | map({machine:.[0].machine,domain:.[0].domain, count:length}) '
[{"machine": "possible_victim01", "domain": "evil.com", "count": 3},
{"machine": "possible_victim02", "domain": "bad.com", …Run Code Online (Sandbox Code Playgroud) 假设我有这个输入:
ID date_1 date_2 str
1 1 2010-07-04 2008-01-20 A
2 2 2015-07-01 2011-08-31 C
3 3 2015-03-06 2013-01-18 D
4 4 2013-01-10 2011-08-30 D
5 5 2014-06-04 2011-09-18 B
6 5 2014-06-04 2011-09-18 B
7 6 2012-11-22 2011-09-28 C
8 7 2014-06-17 2013-08-04 A
10 7 2014-06-17 2013-08-04 B
11 7 2014-06-17 2013-08-04 B
Run Code Online (Sandbox Code Playgroud)
我想str通过group变量逐步连接列的值ID,如以下输出所示:
ID date_1 date_2 str
1 1 2010-07-04 2008-01-20 A
2 2 2015-07-01 2011-08-31 C
3 3 2015-03-06 2013-01-18 D
4 …Run Code Online (Sandbox Code Playgroud) 在我的映射中有这个字段
"answer": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
Run Code Online (Sandbox Code Playgroud)
我尝试执行此聚合
"aggs": {
"answer": {
"terms": {
"field": "answer"
}
},
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [answer] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
Run Code Online (Sandbox Code Playgroud)
我是否必须更改映射或使用错误的聚合?(刚刚从2.x更新到5.1)
我想TParent通过使用聚合构建一个包含多个子对象的类.有些对象是独立的,有些也可能依赖于其他孩子.所有子对象都必须具有对父对象的引用.我也想尽可能使用接口.
为此我使用TInterfacedObject的TParent并TAggregatedObject为孩子.由于孩子和父母都知道彼此,我使用弱引用以避免循环依赖.事实上,这种行为已经在中定义TAggregatedObject.当我只使用独立的子对象(TIndependantChild)时,一切正常.
当子对象也依赖于其他孩子时会出现问题,请参阅构造函数TDependantChild.我将引用存储在fChild变量中的另一个子对象中,该变量用[weak]Delphi 10 Berlin中引入的attibute标记.FastMM4报告关机时的内存泄漏:
此外,访问违规会导致System.TMonitor.Destroy加注,但只有当FastMM4处于使用状态并且ReportMemoryLeaksOnShutDown为True时才会发生这种情况.
program Project1;
{$APPTYPE CONSOLE}
uses
FastMM4,
System.SysUtils;
type
IParent = interface
['{B11AF925-C62A-4998-855B-268937EF30FB}']
end;
IChild = interface
['{15C19A4E-3FF2-4639-8957-F28F0F44F8B4}']
end;
TIndependantChild = class(TAggregatedObject, IChild)
end;
TDependantChild = class(TAggregatedObject, IChild)
private
[weak] fChild: IChild;
public
constructor Create(const Controller: IInterface; const AChild: IChild); reintroduce;
end;
TParent = class(TInterfacedObject, IParent)
private
fIndependantChild: TIndependantChild;
fDependantChild: TDependantChild;
public
constructor Create;
destructor Destroy; override; …Run Code Online (Sandbox Code Playgroud) City和home类型是以下文档映射中的两个嵌套对象:
"mappings" : {
"home_index_doc" : {
"properties" : {
"city" : {
"type" : "nested",
"properties" : {
"country" : {
"type" : "nested",
"properties" : {
"name" : {
"type" : "text"
}
}
},
"name" : {
"type" : "keyword"
}
}
},
"home_type" : {
"type" : "nested",
"properties" : {
"name" : {
"type" : "keyword"
}
}
},
...
}
}
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试进行以下聚合:获取所有当前文档并显示每个城市的所有home_types.
我想它看起来应该类似于:
"aggregations": {
"all_cities": {
"buckets": [
{
"key": "Tokyo",
"doc_count": …Run Code Online (Sandbox Code Playgroud) 我正在尝试重新创建一个过程,以创建一个对象列表,该对象列表是使用Java 8 Streams的另一个对象列表的集合。
例如,我有一个如下所述的类,它是通过数据库调用或类似方法提供的
public class Order {
private String orderNumber;
private String customerNumber;
private String customerGroup;
private Date deliveryDate;
private double orderValue;
private double orderQty;
}
Run Code Online (Sandbox Code Playgroud)
在我的应用程序的其他地方,我有一个OrderTotal类,该类代表和汇总按客户编号和组分组的Order分组,并汇总orderValue和orderQty的总数。(在customerGroup和customerNumber上使用等于和哈希码)
public class OrderTotal {
private String customerGroup;
private String customerNumber;
private double totalValue;
private double totalQty;
}
Run Code Online (Sandbox Code Playgroud)
我们在Java 8之前实现这一目标的“长手”方法如下
public Collection<OrderTotal> getTotals(List<Order> orders) {
///map created for quick access to the order total for each order
Map<OrderTotal, OrderTotal> map = new HashMap<>();
///loop through all orders adding to the relevaent order total …Run Code Online (Sandbox Code Playgroud) aggregation ×10
composition ×1
counting ×1
database ×1
delphi ×1
export ×1
group-by ×1
hdfs ×1
java ×1
java-8 ×1
java-stream ×1
javascript ×1
jq ×1
json ×1
logfiles ×1
mapping ×1
memory-leaks ×1
nested ×1
python ×1
r ×1
sql ×1
string ×1
unsafe ×1
weak ×1