Security

SSL certificate checker issue: How to see all SSL Certificates in the current search?

pchintha
Engager

Hi please help here

we are using below base search and we need to see all ssl certificates with days left in EST.

index=ssl_certs |rex field=_raw "[^'\n]*'expires=\"(?<expires>[^\\\'\"]+)"| stats c by host expires cert | eval time = strftime( strptime( expires , "%b %d %H:%M:%S %Y %Z" ), "%Y/%m/%d %H:%M:%S %Z")

pchintha_0-1644803789337.png

need exact query for this we tried a lot actually. we are using ssl_checker app for this.

Labels (2)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Based on your search response (which is not a raw data) this could helps you.

index=ssl_certs 
| rex "expires=\"(?<exp>[^\\\]+)\\\n"
| eval expTime = strptime(exp, "%b %d %H:%M:%S %Y %Z"), curTime = now()
| eval leftTime = tostring(expTime - curTime, "duration")
| eval daysLeft = mvindex(split(leftTime, "+"), 0)
| table exp expTime curTime left daysLeft

There are other ways to do it.

r. Ismo 

pchintha
Engager

showing no results

pchintha_0-1644838784730.png

 

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Works with me with that app. Can you add that _raw data from your query so we can test it with your data?

e.g.

index=ssl_certs sourcetype=ssl_certs
| head 10
| table _time _raw

Then add that output inside editors </> (code block) so that it will not changed when you are posting it. 

0 Karma

pchintha
Engager

pchintha_0-1644831115506.png

 

Here is the sample events

 

0 Karma

isoutamo
SplunkTrust
SplunkTrust
Can you post some raw events in code box to helps you?
0 Karma

pchintha
Engager

This helps for me, from in this and expires is in GMT and the expTime is in EST guess so and we need all to know in EST only

pchintha_0-1644841268225.png

 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...