Skip to content

Commit cc6f4cf

Browse files
updated and reformatted tag examples
1 parent 9144d24 commit cc6f4cf

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

README.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ Here's an example where we join the computePhysicalSummaries with the condHclSta
426426
index=* sourcetype=cisco:intersight:computePhysicalSummaries
427427
| dedup Moid
428428
| rename OperPowerState as Power
429-
| join type=outer Moid [search index=* sourcetype=cisco:intersight:condHclStatuses | dedup Moid | Table ManagedObject.Moid, Status, Reason, HardwareStatus, SoftwareStatus, ComponentStatus | rename ManagedObject.Moid as Moid]
430-
| Table source, Power, Name, Model, Serial, Status, Reason, HardwareStatus, SoftwareStatus, ComponentStatus
429+
| join type=outer Moid [search index=* sourcetype=cisco:intersight:condHclStatuses | dedup Moid | table ManagedObject.Moid, Status, Reason, HardwareStatus, SoftwareStatus, ComponentStatus | rename ManagedObject.Moid as Moid]
430+
| table source, Power, Name, Model, Serial, Status, Reason, HardwareStatus, SoftwareStatus, ComponentStatus
431431
```
432432

433433
Here is an example where we get a basic inventory of our FlexPod...
@@ -472,24 +472,39 @@ So it seems very easy to search for Tags{}.Value=Premier if you wanted to find a
472472
The solution that I've come up with using only native Splunk SPL is pretty complex but appears to be safe to use. Here is an example...
473473

474474
``` SPL
475-
index=* sourcetype="cisco:intersight:*" | dedup Moid | rename Tags{}.Key as Key, Tags{}.Value as Value | eval zip=mvzip(Key,Value, ":") | mvexpand zip |rex field=zip mode=sed "s/$/\"}/g" |rex field=zip mode=sed "s/^/{\"Tags./g"| rex field=zip mode=sed "s/:/\": \"/g" | spath input=zip | transaction Moid | search Tags.Intersight.LicenseTier=Premier`
475+
index=* sourcetype="cisco:intersight:*"
476+
| dedup Moid
477+
| rename Tags{}.Key as Key, Tags{}.Value as Value
478+
| eval zip=mvzip(Key,Value, ":") | mvexpand zip
479+
|rex field=zip mode=sed "s/$/\"}/g"
480+
|rex field=zip mode=sed "s/^/{\"Tags./g"
481+
| rex field=zip mode=sed "s/:/\": \"/g"
482+
| spath input=zip
483+
| transaction Moid
484+
| stats count by Tags.Intersight.LicenseTier
476485
```
477486

478487
This approach returns all of the available tags as separate fields named `Tags.<Key>`. This certainly seems much more convenient to use as we can now search the value of specific tags. The Add-on also provides the above as a macro that can be used like this...
479488

480489
``` SPL
481-
index=* sourcetype=cisco:intersight:computePhysicalSummaries | `intersight_tags` | stats count by Tags.Intersight.LicenseTier
490+
index=* sourcetype=cisco:intersight:*
491+
| dedup Moid
492+
| `intersight_tags`
493+
| stats count by source, Tags.Intersight.LicenseTier
482494
```
483495

484496
![Improved Tag Decoding Example](images/improved_tag.png)
485497

486498
An alternate (and perhaps better) approach is using the [array2object](https://splunkbase.splunk.com/app/6161/) application that is available from Splunkbase.
487499

488500
```SPL
489-
index=* sourcetype="cisco:intersight:*" | dedup Moid | array2object path="Tags" key=Key value=Value | search Tags.Intersight.LicenseTier=Premier
501+
index=* sourcetype="cisco:intersight:*"
502+
| dedup Moid
503+
| array2object path="Tags" key=Key value=Value
504+
| stats count by source, Tags.Intersight.LicenseTier
490505
```
491506

492-
This approach provides the same end result to the search above with a much cleaner query syntax.
507+
This approach provides the same end result to the searches above with a much cleaner query syntax.
493508

494509
Read more about [array2object at SplunkBase](https://splunkbase.splunk.com/app/6161/).
495510

@@ -504,7 +519,9 @@ index=* sourcetype=cisco:intersight:aaaAuditRecords Request=TRUNCATED
504519
A further look at the data will indicate that most of these are actually related to routine processing of user preferences and filtering those out gives a much more valuable list of audit logs with truncated Results values.
505520

506521
```SPL
507-
index=* sourcetype=cisco:intersight:aaaAuditRecords Request=TRUNCATED MoType!=iam.UserPreference | rename MoDisplayNames.Name{} as name |table source, Email, Event, MoType, name
522+
index=* sourcetype=cisco:intersight:aaaAuditRecords Request=TRUNCATED MoType!=iam.UserPreference
523+
| rename MoDisplayNames.Name{} as name
524+
| table source, Email, Event, MoType, name
508525
```
509526

510527
Everything else has been pruned of unhelpful data to the point that it shouldn't exceed the 10KB limit. If anything does exceed that 10KB, it will be logged...
@@ -520,7 +537,8 @@ The most useful thing will be the log file from the Add-on. This will be called
520537
It should also be available via the following search...
521538

522539
```SPL
523-
index=_* sourcetype=taintersightaddon:log input=* | table _time input, severity, message
540+
index=_* sourcetype=taintersightaddon:log input=*
541+
| table _time input, severity, message
524542
```
525543

526544
Note that if you have multiple inputs (i.e. different Intersight accounts/appliances) configured in the Add-on, the log messages for all of the configured inputs will be interspersed. The Name from the 'Add Input' dialog above is used in the log to differentiate. In these logs, the name EXAMPLE was used.

0 commit comments

Comments
 (0)