Related
I have Ejabberd 21.01, recently upgraded, though that error/crash doesn't have any relevancy. Just wondering if there is any configuration mismatch or client is sending garbage causing this crash? Have been noticing this crash once in a while. Got following log,
2021-02-09 13:55:46.536 [error] <0.31162.0> gen_server <0.31162.0> terminated with reason: bad return value: #{tls_options => [compression_none,{dhfile,<<"/etc/ssl/ejabberd/dh.pem">>}],mgmt_max_timeout => 300000,mgmt_pending_timer => #Ref<0.3896716666.2157707268.137537>,lserver => <<"server.one.com">>,stream_version => {1,0},mgmt_stanzas_in => 1271,mgmt_id => <<138,233,247,19,252,82,167,106>>,tls_enabled => false,user => <<"11888842">>,stop_reason => {socket,closed},mgmt_max_queue => 5000,codec_options => [ignore_els],mgmt_stanzas_out => 6615,stream_id => <<"6931452676501402135">>,csi_queue => {0,...},...}
2021-02-09 13:55:46.538 [error] <0.31162.0>#p1_server:terminate:878 CRASH REPORT Process <0.31162.0> with 0 neighbours exited with reason: bad return value: #{tls_options => [compression_none,{dhfile,<<"/etc/ssl/ejabberd/dh.pem">>}],mgmt_max_timeout => 300000,mgmt_pending_timer => #Ref<0.3896716666.2157707268.137537>,lserver => <<"server.one.com">>,stream_version => {1,0},mgmt_stanzas_in => 1271,mgmt_id => <<138,233,247,19,252,82,167,106>>,tls_enabled => false,user => <<"11888842">>,stop_reason => {socket,closed},mgmt_max_queue => 5000,codec_options => [ignore_els],mgmt_stanzas_out => 6615,stream_id => <<"6931452676501402135">>,csi_queue => {0,...},...} in p1_server:terminate/7 line 878
2021-02-09 13:55:46.538 [error] <0.913.0> Supervisor ejabberd_c2s_sup had child undefined started with {ejabberd_c2s,start_link,undefined} at <0.31162.0> exit with reason bad return value: #{tls_options => [compression_none,{dhfile,<<"/etc/ssl/ejabberd/dh.pem">>}],mgmt_max_timeout => 300000,mgmt_pending_timer => #Ref<0.3896716666.2157707268.137537>,lserver => <<"server.one.com">>,stream_version => {1,0},mgmt_stanzas_in => 1271,mgmt_id => <<138,233,247,19,252,82,167,106>>,tls_enabled => false,user => <<"11888842">>,stop_reason => {socket,closed},mgmt_max_queue => 5000,codec_options => [ignore_els],mgmt_stanzas_out => 6615,stream_id => <<"6931452676501402135">>,csi_queue => {0,...},...} in context child_terminated
Looks like team has posted a new commit to fix that issue. That seems a little bug.
https://github.com/processone/ejabberd/issues/3524
I send one ArrayList to my Laravel server, I have good response (200) and I received my list, but in my Android application the callback function of volley library OnResponse is never call.
JsonArrayRequest stringRequest = new JsonArrayRequest(url, jsonRequest,
new Response.Listener<JSONArray>() {
#Override
public void onResponse(JSONArray response) {
Log.d(TAG, "dropTable");
dabAcces.dropTable();
}
}, new Response.ErrorListener() {
#Override
public void onErrorResponse(VolleyError error) {
if (row > MAX_REGISTER_GPS_DATA) {
Log.d(TAG, "deleteOldestRecord");
dabAcces.deleteOldestRecord();
}
}
});
// Add the request to the RequestQueue.
queue.add(stringRequest);
}
The function never enter to onResponse, can not display response.
This is my Android code with volley HTTP POST :
JSONArray jsonRequest = new JSONArray();
for(MyLocation myLocation : ListLocation){
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("serial", myLocation.serial);
jsonObject.put("longitude", myLocation.longitude);
jsonObject.put("latitude", myLocation.latitude);
jsonObject.put("altitude", myLocation.altitude);
jsonObject.put("accuracy", myLocation.accuracy);
jsonObject.put("detect_at", myLocation.date);
jsonRequest.put(jsonObject);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
JsonArrayRequest stringRequest = new JsonArrayRequest(url, jsonRequest,
new Response.Listener<JSONArray>() {
#Override
public void onResponse(JSONArray response) {
Log.d(TAG, "dropTable");
Log.d(TAG, "response " + response );
dabAcces.dropTable();
}
}, new Response.ErrorListener() {
#Override
public void onErrorResponse(VolleyError error) {
Log.d(TAG, "onErrorResponse" + error);
if (row > MAX_REGISTER_GPS_DATA) {
Log.d(TAG, "deleteOldestRecord");
dabAcces.deleteOldestRecord();
}
}
});
// Add the request to the RequestQueue.
queue.add(stringRequest);
}
}
This is my Laravel Controller code :
public function store()
{
foreach ($input as $values){
$tracker = new Tracker;
$tracker->serial = $values["serial"];
$tracker->latitude = $values["latitude"];
$tracker->longitude = $values["longitude"];
$tracker->altitude = $values["altitude"];
$tracker->accuracy = $values["accuracy"];
$tracker->detect_at = $values["detect_at"];
$tracker->created_at = \Carbon\Carbon::now()->toDateTimeString();
$tracker->updated_at = \Carbon\Carbon::now()->toDateTimeString();
$tracker->save();
}
}
This is my log in Laravel, array sending by android application.
0 =>
array (
'detect_at' => '2015-08-14 06:14:11',
'longitude' => '-1.74099',
'latitude' => '48.0492',
'accuracy' => '39.695',
'serial' => '7447c0f2916a7159',
'altitude' => '0',
),
1 =>
array (
'detect_at' => '2015-08-14 06:14:15',
'longitude' => '-1.74095',
'latitude' => '48.0492',
'accuracy' => '42.057',
'serial' => '7447c0f2916a7159',
'altitude' => '0',
),
2 =>
array (
'detect_at' => '2015-08-14 06:14:17',
'longitude' => '-1.74092',
'latitude' => '48.0492',
'accuracy' => '43.351',
'serial' => '7447c0f2916a7159',
'altitude' => '0',
),
3 =>
array (
'detect_at' => '2015-08-14 06:18:59',
'longitude' => '-1.74095',
'latitude' => '48.0492',
'accuracy' => '41.781',
'serial' => '7447c0f2916a7159',
'altitude' => '0',
),
4 =>
array (
'detect_at' => '2015-08-14 06:19:01',
'longitude' => '-1.74093',
'latitude' => '48.0492',
'accuracy' => '42.812',
'serial' => '7447c0f2916a7159',
'altitude' => '0',
),
5 =>
array (
'detect_at' => '2015-08-14 06:19:03',
'longitude' => '-1.74093',
'latitude' => '48.0492',
'accuracy' => '42.812',
'serial' => '7447c0f2916a7159',
'altitude' => '0',
),
6 =>
array (
'detect_at' => '2015-08-14 06:19:05',
'longitude' => '-1.74093',
'latitude' => '48.0492',
'accuracy' => '42.948',
'serial' => '7447c0f2916a7159',
'altitude' => '0',
),
7 =>
array (
'detect_at' => '2015-08-14 06:20:19',
'longitude' => '-1.74095',
'latitude' => '48.0492',
'accuracy' => '41.865',
'serial' => '7447c0f2916a7159',
'altitude' => '0',
),
Im currently trying to receive this url in java (https://api.wynncraft.com/public_api.php?action=items&command=75)
The problem is, I can read any file ending in .json perfectly, but because of the .php (I think) it isnt working for this one.
Also, if someone could tell me how to get things like item_name into variables I can use? Would be great...
My code:
URL u;
try {
u = new URL("https://api.wynncraft.com/public_api.php?action=items&command=75");
URLConnection c = u.openConnection();
InputStream r = c.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(r));
for (String line; (line = reader.readLine()) != null;)
System.out.println(line);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Download the json.api JAR from http://mvnrepository.com/artifact/org.json/json (or use Maven)
Change your code to read the entire string, not just a line.
Then do something like this to get at the values you want.
import org.json.*;
JSONParser JSON = new JSONParser();
JSONObject obj = JSON.parse(line);
String hr0 = obj.getJSONObject("0")
.getJSONObject("Identification")
.getString("health_regen");
This is a little cryptic, buy you should be able ascertain the variable values.
This is how the JSON would be structured if you were to use PHP:
$json = json_decode($data,true);
k1, k2 denote the level with in the structure.
-------------------------------
k0 request => array(
k1: timestamp => integer: $json['request']['timestamp'] => 1430494697
k1: ip => string: $json['request']['ip'] => 108.162.210.100
)
-------------------------------
k0 0 => array(
k1: item_name => string: $json[0]['item_name'] => Bob's Mythic Bow
k1: item_type => string: $json[0]['item_type'] => Legendary
k1: item_minecraft => string: $json[0]['item_minecraft'] => Bow
k1: item_min_lvl => string: $json[0]['item_min_lvl'] => 75
k1 identification => array(
k2: health_regen => string: $json[0]['identification']['health_regen'] => 1.5
k2: mana_regen => string: $json[0]['identification']['mana_regen'] => 1
k2: spell_dam => string: $json[0]['identification']['spell_dam'] => 30%
k2: life_steal => string: $json[0]['identification']['life_steal'] => 0.4
k2: mana_steal => string: $json[0]['identification']['mana_steal'] => 1
k2: xp_bonus => string: $json[0]['identification']['xp_bonus'] => 20%
k2: loot_bonus => string: $json[0]['identification']['loot_bonus'] => 20%
)
k1: min_dam => string: $json[0]['min_dam'] => 566
k1: max_dam => string: $json[0]['max_dam'] => 463
)
-------------------------------
k0 1 => array(
k1: item_name => string: $json[1]['item_name'] => Bob's Mythic Daggers
k1: item_type => string: $json[1]['item_type'] => Legendary
k1: item_minecraft => string: $json[1]['item_minecraft'] => Shears
k1: item_min_lvl => string: $json[1]['item_min_lvl'] => 75
k1 identification => array(
k2: health_regen => string: $json[1]['identification']['health_regen'] => 1.5
k2: mana_regen => string: $json[1]['identification']['mana_regen'] => 1
k2: spell_dam => string: $json[1]['identification']['spell_dam'] => 30%
k2: life_steal => string: $json[1]['identification']['life_steal'] => 0.4
k2: mana_steal => string: $json[1]['identification']['mana_steal'] => 1
k2: xp_bonus => string: $json[1]['identification']['xp_bonus'] => 20%
k2: loot_bonus => string: $json[1]['identification']['loot_bonus'] => 20%
)
k1: min_dam => string: $json[1]['min_dam'] => 420
k1: max_dam => string: $json[1]['max_dam'] => 389
)
-------------------------------
k0 2 => array(
k1: item_name => string: $json[2]['item_name'] => Bob's Mythic Spear
k1: item_type => string: $json[2]['item_type'] => Legendary
k1: item_minecraft => string: $json[2]['item_minecraft'] => Shovel
k1: item_min_lvl => string: $json[2]['item_min_lvl'] => 75
k1 identification => array(
k2: health_regen => string: $json[2]['identification']['health_regen'] => 1.5
k2: mana_regen => string: $json[2]['identification']['mana_regen'] => 1
k2: spell_dam => string: $json[2]['identification']['spell_dam'] => 30%
k2: life_steal => string: $json[2]['identification']['life_steal'] => 0.4
k2: mana_steal => string: $json[2]['identification']['mana_steal'] => 1
k2: xp_bonus => string: $json[2]['identification']['xp_bonus'] => 20%
k2: loot_bonus => string: $json[2]['identification']['loot_bonus'] => 20%
)
k1: min_dam => string: $json[2]['min_dam'] => 368
k1: max_dam => string: $json[2]['max_dam'] => 311
)
-------------------------------
k0 3 => array(
k1: item_name => string: $json[3]['item_name'] => Bob's Mythic Wand
k1: item_type => string: $json[3]['item_type'] => Legendary
k1: item_minecraft => string: $json[3]['item_minecraft'] => Stick
k1: item_min_lvl => string: $json[3]['item_min_lvl'] => 75
k1 identification => array(
k2: health_regen => string: $json[3]['identification']['health_regen'] => 1.5
k2: mana_regen => string: $json[3]['identification']['mana_regen'] => 1
k2: spell_dam => string: $json[3]['identification']['spell_dam'] => 30%
k2: life_steal => string: $json[3]['identification']['life_steal'] => 0.4
k2: mana_steal => string: $json[3]['identification']['mana_steal'] => 1
k2: xp_bonus => string: $json[3]['identification']['xp_bonus'] => 20%
k2: loot_bonus => string: $json[3]['identification']['loot_bonus'] => 20%
)
k1: min_dam => string: $json[3]['min_dam'] => 278
k1: max_dam => string: $json[3]['max_dam'] => 204
)
#################################################################
Summary of Array Constructs With Output Type
#################################################################
1 $json[int]['identification']['health_regen'] string
1 $json[int]['identification']['mana_regen'] string
1 $json[int]['identification']['spell_dam'] string
1 $json[int]['identification']['life_steal'] string
1 $json[int]['identification']['mana_steal'] string
1 $json[int]['identification']['xp_bonus'] string
1 $json[int]['identification']['loot_bonus'] string
I have a Java application that ouputs log in the format
timestamp UUID1 some information
timestamp UUID1 some more information
timestamp UUID1 x = 1
timestamp UUID2 some information
timestamp UUID2 some more information
timestamp UUID2 x = 2
timestamp UUID3 some information
timestamp UUID3 some more information
timestamp UUID3 x = 1
I want to implement a log analysis framework using Elsatic Search, LogStash and Kibana. Is it possible to get the logs only according to X value?
For example:-
If I query X = 1, I should get only the following logs.
timestamp UUID1 some information
timestamp UUID1 some more information
timestamp UUID1 x = 1
timestamp UUID3 some information
timestamp UUID3 some more information
timestamp UUID3 x = 1
If I query X = 2, I should get only the following logs.
timestamp UUID2 some information
timestamp UUID2 some more information
timestamp UUID2 x = 2
I am in control of the log message format. If it is not directly popssible to do this query, I can change the message format also.
UPDATE 1:
I will be a little more specific.
The following are my log statements.
MDC.put("uuid", UUID.randomUUID().toString());
logger.info("Assigning value to the variable : {}", name);
this.setVal(value.getVal());
logger.info("{} = {}", name, value.getVal());
logger.info("Assigned value {} to the variable : {}", value.getVal(),
name);
MDC.clear();
I received the log statements in Logstash using UDP. And I am getting the messages like.
{
"#timestamp" => "2015-04-01T10:23:37.846+05:30",
"#version" => 1,
"message" => "Assigning value to the variable : X",
"logger_name" => "com.example.logstash.Variable",
"thread_name" => "pool-1-thread-1",
"level" => "INFO",
"level_value" => 20000,
"HOSTNAME" => "pnibinkj-W7-1",
"uuid" => "ab17b842-8348-4474-98e4-8bc2b8dd6781",
"host" => "127.0.0.1"
}
{
"#timestamp" => "2015-04-01T10:23:37.846+05:30",
"#version" => 1,
"message" => "Assigning value to the variable : Y",
"logger_name" => "com.example.logstash.Variable",
"thread_name" => "pool-1-thread-2",
"level" => "INFO",
"level_value" => 20000,
"HOSTNAME" => "pnibinkj-W7-1",
"uuid" => "d5513e4c-de3b-4144-87e4-87b077ac8056",
"host" => "127.0.0.1"
}
{
"#timestamp" => "2015-04-01T10:23:37.862+05:30",
"#version" => 1,
"message" => "Y = 1",
"logger_name" => "com.example.logstash.Variable",
"thread_name" => "pool-1-thread-2",
"level" => "INFO",
"level_value" => 20000,
"HOSTNAME" => "pnibinkj-W7-1",
"uuid" => "d5513e4c-de3b-4144-87e4-87b077ac8056",
"host" => "127.0.0.1"
}
{
"#timestamp" => "2015-04-01T10:23:37.863+05:30",
"#version" => 1,
"message" => "X = 1",
"logger_name" => "com.example.logstash.Variable",
"thread_name" => "pool-1-thread-1",
"level" => "INFO",
"level_value" => 20000,
"HOSTNAME" => "pnibinkj-W7-1",
"uuid" => "ab17b842-8348-4474-98e4-8bc2b8dd6781",
"host" => "127.0.0.1"
}
{
"#timestamp" => "2015-04-01T10:23:37.863+05:30",
"#version" => 1,
"message" => "Assigned value 1 to the variable : X",
"logger_name" => "com.example.logstash.Variable",
"thread_name" => "pool-1-thread-1",
"level" => "INFO",
"level_value" => 20000,
"HOSTNAME" => "pnibinkj-W7-1",
"uuid" => "ab17b842-8348-4474-98e4-8bc2b8dd6781",
"host" => "127.0.0.1"
}
{
"#timestamp" => "2015-04-01T10:23:37.863+05:30",
"#version" => 1,
"message" => "Assigned value 1 to the variable : Y",
"logger_name" => "com.example.logstash.Variable",
"thread_name" => "pool-1-thread-2",
"level" => "INFO",
"level_value" => 20000,
"HOSTNAME" => "pnibinkj-W7-1",
"uuid" => "d5513e4c-de3b-4144-87e4-87b077ac8056",
"host" => "127.0.0.1"
}
There are 2 UUIDs
"d5513e4c-de3b-4144-87e4-87b077ac8056" for "Y = 1"
"ab17b842-8348-4474-98e4-8bc2b8dd6781" for "X = 1"
There are two other messages for each UUID. I want to combine them into a single event.
I am not sure, how to write the multiline filter for this case.
filter {
multiline {
pattern => "."
what => "previous"
stream_identity => "%{uuid}"
}
}
"pattern" and "what" are required fields, it seems. What should I provide for these fields. How do I use Stream Identity?
Please point me in right direction.
Thanks,
Paul
You would need to combine your messages (see multiline{} filter, which supports stream_identity), and then a regular query would return the appropriate message.
this should be possible using the kibana filters if X is some unique value, but with the logs in the format shown you'd need to use the multiline filter to join the entries together.
With that in place, you could probably use a query something like
message: "X=1"
I am trying to insert a key index to FILE array. I just want to know that is this work in FILE array or not ?
$files = $_FILES;
print_r($files);
Array
(
[image] => Array
(
[name] => 400.png
[type] => image/png
[tmp_name] => /tmp/php5Wx0aJ
[error] => 0
[size] => 15726
)
)
what i want is like this below:
$files = $_FILES;
print_r($files);
Array
(
[image] => Array
(
[name] => 400.png
[type] => image/png
[tmp_name] => /tmp/php5Wx0aJ
[error] => 0
[size] => 15726
[myid]=> my value
)
)
Is it possible to push key index into $_FILE array with the PHP function?
Yes, you can do it as follows:
$files['image']['myid'] = 'my value';
IIRC, the 'image' key to the $_FILES array is the name of the control in your HTML, if you were just looking for a way to identify which of multiple files is which.