D
D
dimjkee902020-11-17 11:21:21
linux
dimjkee90, 2020-11-17 11:21:21

How to find a parameter in the logs and output to a file?

Good afternoon!
Tell me how you can implement it

. It is necessary to collect statistics in the application logs for 5-7 days; logs on a Linux wheelbarrow in /var/log/partner/xxxxx.log
Find all transparent calls, for example
, /partner/transparent?service_id=15&partner_id=666&amount=400 )
Extract from them partner_id
Need a list of unique partner id or service_id (if no partner)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Victor Taran, 2020-11-17
@dimjkee90

do I understand your logic correctly, you need not just grep by patterns, but also a condition that will allow you to leave one of the values ​​in the line?
If not, then give a real example. and also important is the output format to a string not to a string two arguments 1 and so on what url options are

D
Dmitry, 2020-11-17
@q2digger

grep + sed + awk + sort + uniq

S
Saboteur, 2020-11-17
@saboteur_kiev

grep  -o /var/log/partner/*.log 'transparent.*partner_id=\K\d' | sort -q

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question