-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cff6a8d
commit cc3c5e8
Showing
4 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.gradle | ||
build | ||
temp | ||
work | ||
supervisord.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# XLD config hash utility | ||
|
||
## Usage | ||
|
||
1. Apply this entry to the conf/logback.xml file for each node to be examined. | ||
|
||
<logger name="com.xebialabs.deployit.engine.tasker.distribution.versioning" level="trace" /> | ||
2. Copy the logs to a host with a Python 2.7 installation. | ||
|
||
3. Configure the properties file with the appropriate start and end datetimes for the two logs. | ||
|
||
4. Run the following after substituting your log file names: | ||
|
||
python xld-config-hash-utility.py deployit_master.log deployit_worker.log. | ||
|
||
5. Review the output for configuration hash mismatches. | ||
|
||
Sample output: | ||
|
||
~~~ | ||
$ python xld-config-hash-utility.py deployit_master.log deployit_worker.log | ||
Read 187 lines from /Users/droberts/2023Jul01-config-hash-utility/deployit_master.log | ||
Processing 159 hashed items from /Users/droberts/2023Jul01-config-hash-utility/deployit_master.log | ||
Read 193 lines from /Users/droberts/2023Jul01-config-hash-utility/deployit_worker.log | ||
Processing 159 hashed items from /Users/droberts/2023Jul01-config-hash-utility/deployit_worker.log | ||
----------------------------------------------------------------------------------- | ||
Compare /Users/droberts/2023Jul01-config-hash-utility/deployit_master.log (left) to /Users/droberts/2023Jul01-config-hash-utility/deployit_worker.log (right) | ||
Match 157 items in left log to right log | ||
Mismatch on item xl.scheduler.system.akka.loggers:"akka.event.Logging$DefaultLogger" in left file but not in right file | ||
Mismatch on item database-plugin-9.5.1.xldp: | ||
left file hash is f283c1bd26665a47a4c5df98655514634a17bd5bb5f2a78370f3457034c4aa15 | ||
right file hash is f283c1bd26665a47a4c5df98655514634a17bd5bb5f2a78370f3457034c4aa10 | ||
Mismatch on item jee-plugin-9.5.1.xldp: | ||
left file hash is d8b4c2ea2dae5e72991da2f2fac387eb22286de24316c2ac00887a01fb57d140 | ||
right file hash is d8b4c2ea2dae5e72991da2f2fac387eb22286de24316c2ac00887a01fb57d141 | ||
----------------------------------------------------------------------------------- | ||
Compare /Users/droberts/2023Jul01-config-hash-utility/deployit_worker.log (left) to /Users/droberts/2023Jul01-config-hash-utility/deployit_master.log (right) | ||
Match 157 items in left log to right log | ||
Mismatch on item xl.scheduler.system.akka.loggers:"akka.event.slf4j.Slf4jLogger" in left file but not in right file | ||
Mismatch on item database-plugin-9.5.1.xldp: | ||
left file hash is f283c1bd26665a47a4c5df98655514634a17bd5bb5f2a78370f3457034c4aa10 | ||
right file hash is f283c1bd26665a47a4c5df98655514634a17bd5bb5f2a78370f3457034c4aa15 | ||
Mismatch on item jee-plugin-9.5.1.xldp: | ||
left file hash is d8b4c2ea2dae5e72991da2f2fac387eb22286de24316c2ac00887a01fb57d141 | ||
right file hash is d8b4c2ea2dae5e72991da2f2fac387eb22286de24316c2ac00887a01fb57d140 | ||
----------------------------------------------------------------------------------- | ||
Execution completed | ||
~~~ |
13 changes: 13 additions & 0 deletions
13
xld-config-hash-utility/xld-config-hash-utility.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[CommonSection] | ||
datetime_pattern=([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}) | ||
hash_pattern=Using hash ([0-9a-f]{64}) for (\S+) | ||
divider_char=- | ||
divider_length=83 | ||
|
||
[Log1Section] | ||
start_datetime=2020-02-05 00:00:00.000 | ||
end_datetime=2020-02-05 23:59:59.999 | ||
|
||
[Log2Section] | ||
start_datetime=2020-02-05 00:00:00.000 | ||
end_datetime=2020-02-05 23:59:59.999 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Run as python xld-config-hash-utility.py log1.log log2.log | ||
# Configure xld-config-hash-utility.properties file in this way: | ||
# [CommonSection] | ||
# datetime_pattern=([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}) | ||
# hash_pattern=Using hash ([0-9a-f]{64}) for (\S+) | ||
# | ||
# [Log1Section] | ||
# start_datetime=2020-02-05 00:00:00.000 | ||
# end_datetime=2020-02-05 23:59:59.999 | ||
# | ||
# [Log2Section] | ||
# start_datetime=2020-02-05 00:00:00.000 | ||
# end_datetime=2020-02-05 23:59:59.999 | ||
# | ||
|
||
import re | ||
import sys | ||
import ConfigParser | ||
|
||
def create_map(pattern, log_file_path, key_hash_map, start_datetime, end_datetime): | ||
line_count = 0 | ||
matched_line_count = 0 | ||
log_file = open(log_file_path) | ||
for line in log_file: | ||
line_count += 1 | ||
m = pattern.match(line) | ||
if m: | ||
matched_line_count += 1 | ||
line_datetime = m.group(1) | ||
line_hash = m.group(2) | ||
line_itemname = m.group(3) | ||
if m.group(1) >= start_datetime and m.group(1) <= end_datetime: | ||
key_hash_map[m.group(3)] = m.group(2) | ||
log_file.close() | ||
print "Read %s lines from %s" % (line_count, log_file_path) | ||
print "Processing %s hashed items from %s" % (matched_line_count, log_file_path) | ||
|
||
def compare_maps(key_hash_map_1, key_hash_map_2): | ||
print "Match %d items in left log to right log\n" % len(key_hash_map_1) | ||
for key in key_hash_map_1.keys(): | ||
if key in key_hash_map_2.keys(): | ||
if key_hash_map_1[key] == key_hash_map_2[key]: | ||
continue | ||
else: | ||
print "Mismatch on item %s:\nleft file hash is %s\nright file hash is %s\n" % (key, key_hash_map_1[key], key_hash_map_2[key]) | ||
else: | ||
print "Mismatch on item %s in left file but not in right file\n" % key | ||
|
||
config = ConfigParser.RawConfigParser() | ||
config.read('xld-config-hash-utility.properties') | ||
|
||
datetime_pattern = config.get('CommonSection', 'datetime_pattern') | ||
hash_pattern = config.get('CommonSection', 'hash_pattern') | ||
pattern = re.compile(datetime_pattern + ".*" + hash_pattern + ".*") | ||
|
||
log1_map = {} | ||
log2_map = {} | ||
divider = config.get('CommonSection', 'divider_char') * int(config.get('CommonSection', 'divider_length')) + "\n" | ||
print "" | ||
create_map(pattern, sys.argv[1], log1_map, config.get('Log1Section', 'start_datetime'), config.get('Log1Section', 'end_datetime')) | ||
print "" | ||
create_map(pattern, sys.argv[2], log2_map, config.get('Log1Section', 'start_datetime'), config.get('Log1Section', 'end_datetime')) | ||
print "\n" + divider | ||
print "Compare %s (left) to %s (right)" % (sys.argv[1], sys.argv[2]) | ||
compare_maps(log1_map, log2_map) | ||
print divider | ||
print "Compare %s (left) to %s (right)" % (sys.argv[2], sys.argv[1]) | ||
compare_maps(log2_map, log1_map) | ||
print divider | ||
print "Execution completed" |